What is Javascipt?

JavaScript enables interactive elements in websites.

HTML only gives you the display but JavaScript allows you to run programs behind the display to actually do complex tasks. It could be basic stuff like send emails, display pop-up menus, change things on the screen depending on what the user clicks, that sort of thing, right up to complicated whole programs on web pages. The wide support of JavaScript throughout all the most popular web browsers makes it one of the most widely-used programming languages in use today.

Let’s discuss important parts of Javascript:

Prototype-based: this is a programming term that refers to the types of objects that can be created in the language. It means that objects in JavaScript are not confined to sets of behaviours (known as classes in programming jargon).

Scripting: in programming, scripts are programs used by other software to automate tasks or allow the user to create new tasks to be automated. JavaScript is primarily used by web browsers to do other tasks, and so is primarily a scripting language.

Dynamic: in this context, dynamic means that JavaScript runs when the web page loads and can make other alterations to the page (and to it’s own code!) as the program runs.

Weakly typed: variables of different types can be automatically converted and combined according to a set of rules. For example, adding the number 5 to the string “25” will result in the string “525” being created.

First-class functions: This means that you can pass functions as arguments and return them as results, and assign them to variables (in programming jargon). Basically this means that whole functions are treated as programming components in their own right, not just as operations performed on data and variables.

Multi-paradigm: JavaScript can be programmed in a variety of styles:
Object-oriented: uses data, methods and the interaction between objects
Imperative: each statement actively changes something
Functional: each statement describes the intended outcome

So that’s the technical explanation. It describes JavaScript as a language that allows functions and objects to be created and manipulated, and to interact with each other. It also mentions that you have some freedom with the types of data you use (ie numbers, strings etc).

But what is Javascript actually used for?

JavaScript has a history almost as long as web design itself and has been used for different tasks as time progressed. Originally it was developed to reduce the amount of data web servers needed to send to browsers – it used to be that the whole page would need to be sent when a user operated a function on a webpage! A battle between Netscape (the original inventors) and Microsoft saw two different versions of the language developed simultaneously, with each side inventing new functions.

Originally JavaScript was used primarily for making web pages interactive – as simply as changing the colour of links when the mouse hovers over it or clicks on it, sending information to web servers, sending emails directly from web pages, that sort of thing. It also was used to verify data sent to web servers by checking against a list embedded in the code of the webpage.

JavaScript was also used for tracking users information in cookies, small bits of data stored on the user’s computer to keep information about what you did on their website. Companies can tailor the content that appears on your screen – such as advertisements for items you commonly browse for. Cookies were also widely used to save time by saving copies of static HTML code (saving data transmission) but the use of malicious or malevolent cookies gave JavaScript a bad name for a few years.

Soon many stand-alone functions were available that could be implemented into new webpages by downloading the code and modifying the appearance with HTML and CSS, such as:

  • form validators
  • fancy drop-down menus
  • secure email forms
  • basic (and some complicated) games
  • alerts, warnings and messages to users

The development of Flash led to the decline of JavaScript for use in embedded programs, with its animation and multimedia applications. But more recent developments such as JQuery, AJAX and better web security practices (such as better server-side programming) have seen JavaScript being used more commonly again.

JQuery has a library of useful JavaScript functions which enable programmers to save time and create programs more easily by referring to common functions simply by their name, rather than program the function in full in their own programs. There are hundreds (perhaps thousands) of JavaScript libraries created to make specific types of programming easier.

AJAX is a concept that refers to the combination of languages used to display, collect, store and manipulate data in web pages. It isn’t a language in itself but uses JavaScript to manipulate and compute data and allow dynamic changes to the display of a web page. Developments in the way JavaScript communicates with the HTML and CSS of a web page have made it even more powerful as the organising language to control and modify the layout and data of web pages.

JavaScript earned a bad reputation for a while as it was the language used by entities to store data on your own computer, and is versatile enough to program malicious content – so much so that for a few years users were (and still often are) encouraged to disable JavaScript scripts from running in their browser. Developers were even advised to ensure that no essential functions relied on JavaScript!

Today with better malware detection and the large number of libraries available for all sorts of tasks, JavaScript is used more widely than ever before.

Other Articles you might be interested in

HTML5_Logo

HTML5 Explained

What is HTML5? HTML is the code used to program what you see on the screen when you view a website in a browser. HTML5 is the latest incarnation of … [Read More...]

internet-security-essentials

Internet Security Essentials

Securing your Email Your computer is at risk! Potentially unwanted program alert! Protect your computer from infection! We are bombarded with … [Read More...]

About Robin Jennings

I'm a creative web designer that specialises in designing and marketing websites for small business owners, community groups and creative types. I'm based in regional Victoria but work with clients Australia-Wide as well as a healthy sprinkling of overseas clients through my Web Design Agency: Explainafide

Speak Your Mind

*