But what is JavaScript? Where did it come from? And how is it so popular among web developers?
These three questions; the what, where and how are your best way to learn more in life and in this post I will be answering them for you!
What is JavaScript?
JavaScript is a client-side scripting language, this means it is interpreted on the web page viewer's browser. Today's major Web Browsers all support JavaScript, therefore you can be rest assured that your JavaScript code will work on the client's machine if JavaScript is enabled (It is by default).
But why is it used you may be asking your self, well the answer is simple, JavaScript is the easiest way to provide dynamic user-interaction to web pages, without having to send loads of HTTP Requests to the host server and without having to refresh the whole page just to make a change to the displayed web page.
This means, that unlike other server-side technologies used for web interaction, such as JSP(Java Server Pages), JavaScript can dynamically change parts of the web page the user is viewing at the client-side without having to refreshing the page.
Where did JavaScript come from?
So it's time for a bit of history then!
The language was developed by Brendan Eich when he was hired by Netscape to develop it for them in-order to make their support for Java applets more accessible to non-Java programmers and web designers.
The language was first called 'LiveScript', to reflect its dynamic nature, but for marketing purposes it got renamed to JavaScript.
In 1995, Netscape and Sun Microsystems jointly launched the new language and termed it a "compliment" to HTML and Java.
From an early start, developers started to use JavaScript to manipulate images and page content, instead of controlling Java applets. Thus changing the web from just static pages to dynamically interactive interfaces.
But unfortunately, JavaScript's advantages of not requiring a compiler to run, being overly easy to use, having impressive cross-platform compatibility and the issue of multiple JavaScript books for non-programmers made experienced developers snob it and describe it as a toy, which ended up overshadowing its full potential.
None the less, JavaScript was being used out there and Microsoft responded with its VBScript and later with JScript, starting a browser war!
This eventually led to a nightmare for cross-browser compatability, forcing Microsoft, Netscape and other browser companies to work with the World Wide Web Consortium (W3C) in-order to achieve a standard, cross-browser compatible Document Object Model (DOM).
How is it so popular among web developers?
Today, now that almost all browsers use W3C's standard DOM, JavaScript has grown into a powerful scripting language, containing the best features of:
- Perl
- associative arrays
- loosely typed variables
- regular expressions
- Java
- clean syntax
- objects and classes
- highly evolved date, math, and string libraries
To code in JavaScript, you don't need any special software either, a simple application such as Notepad is enough, all you have to do when you're ready from creating your functions is save the file format to '.js' in-order to identify it as a JavaScript file and import it into your HTML file by using the <script> tag.
JavaScript can also be embedded within the HTML its self, both within the <head> element or within the <body> element. But it is good practice to separate your JavaScript code for the sake of easy re-usability in other web pages.
Now, as you might have realised, all these advantages are what made JavaScript the most popular scripting language used on the web.
What other purpose could JavaScript be used for?
Well, seeing that internet connectivity is available almost everywhere we go nowadays and devices capable of connecting to the internet are always getting smaller and lighter, I would think that if a touch-screen device, such as an IPad, gets installed into public vehicles, we could store all of our favourite songs, videos, pictures and documents in the cloud and then use JavaScript's dynamic nature to create a web interface which is personalized to every user's liking and would access our private on-line libraries and allow us to either playback our music, view our favourite pictures or even touch-up a business proposal presentation while being driven along.
This system could also be used as a safety feature in private vehicles which would work in the background by making use of the device's location detection functionality to calculate the speed the vehicle is going and if the speed is excessive, JavaScript's dynamic capabilities can be used to change the interface's look to an alarming one, indicating to the driver that he/she should slow down.
Other Links
For me to create this post, I researched the information from the following post:
No comments:
Post a Comment