Overview
A common misconception is that JavaScript is similar to, or closely related to, Java. It is true that both have a syntax resembling C (their most direct ancestor) but they have little else in common. For example, all of Java’s keywords are used by JavaScript, JavaScript’s standard libraries follow Java’s naming conventions, and some JavaScript objects such as Date and Time are based on Java classes. That is where the similarities end!
Features of JavaScript
JavaScript is a structured language, a feature it inherited from C.
It is dynamic both in its typing, for example a variable that holds a number can later store text, and in its execution, which happens at run time.
It is object-oriented and also functional: every function is an object, so it can have properties and methods. It supports nested functions as well as anonymous functions.
The most common use of JavaScript is to add behaviour to HTML on the user’s side, which is also known as Dynamic HTML. Scripts are embedded in HTML pages and interact with the Document Object Model (DOM).
Security
JavaScript and the DOM make it possible for malicious developers to spread scripts that can run on a user’s computer over the internet.
Browser developers limit this risk with two restrictions.
First, scripts run in a sandbox, where they can only carry out web-related actions and cannot perform general-purpose programming tasks such as creating files.
Second, scripts are restricted by the same-origin policy: scripts from one site have no access to information such as usernames, passwords or cookies sent to another site.
Most JavaScript-related security holes are breaches of either the same-origin policy or the sandbox.
A little history
JavaScript was originally developed in 10 days in May 1995 by Brendan Eich, while he was working for Netscape Communications Corporation. At the time Netscape was competing with Microsoft over the adoption of web technologies and platforms, and was considering launching a distributed operating system with a portable version of Java, providing an environment in which applications could run.
Because Java competed with C++ and was aimed at professional programmers, Netscape wanted a lightweight interpreted language to complement Java and appeal to non-professional programmers, much like Microsoft’s Visual Basic.
JavaScript was later adopted by Microsoft as well.
JavaScript has become one of the most popular languages on the web. Even so, many professional programmers originally looked down on it, among other reasons because its audience was web developers and other such “amateurs”.
The arrival of Ajax brought JavaScript back into the spotlight and won it more attention from professional programmers.



Leave a comment