Introduction to JavaScript

Imagine calling JavaScript Livescript, who would have known?

Introduction

JavaScript is an interpreted programming language with Object Oriented capabilities. Syntactically, the core JS language resembles C, C++ and Java, with programming constructs such as if statement, the while loop and the && operator. However, this similarity ends with it's syntactic resemblance with the other programming languages: C, C++ and Java.

The core JS language and built-in datatypes (numbers, strings, Boolean, array, date and regular-expression objects) are subject of international standards, and compatibility across implementations is very good.

For its cross-browser's compatibility, JavaScript is most commonly used in web-browsers, and in this context, the general-purpose core is extended with objects that allow scripts to interact with the user, control the web browser and alter the DOM content that appears within the web-browser window.

The term 'client-side JavaScript' is used to emphasize the scripts that are run by the client computer rather than the web server.

JavaScript Characteristics

  • JavaScript is a loosely typed language, which means that variables do not need to have a type specified.
  • Objects in JavaScript map property names to arbitrary property values. In this way, they are more like hash-tables or associative arrays (in Perl) than they are like structs (in C) or objects (in C++ or Java).
  • The Object-Oriented inheritance mechanism of JS is prototype-based like that of the little-known language Self. This is quite different from inheritance in C++ and Java.
  • Like Perl, JavaScript is an interpreted language and it draws inspiration from Perl in a number of areas, such as it's regular-expression and array-handling features.

JavaScript is not Java

One of the most common misconceptions about JavaScript is that it is a simplified version of Java. Other than an incomplete syntactic resemblance, and the fact that both Java and JavaScript can provide executable content in web browsers, the two languages are entirely unrelatable.

The similarity of the names is purely a marketing ploy by Netscape and Sun, as the language was originally called Livescript until it as changed at the last minute. However, JavaScript can, in fact, script Java

Imagine calling 'Livescript', who would have known? ☺

JavaScript is not simple!

Because JavaScript is interpreted instead of compiled, it is often considered a scripting language instead of a true programming language. The implication is that scripting languages are simpler and that they are programming languages for non-programmers. The fact that JS s loosely typed does make it somewhat more forgiving for unsophisticated programmers.

Beneath it's thin veneer of simplicity, however, JavaScript is a full-fledged programming language, as complex as any and more complex than some. Programmers who attempt to use JavaScript for non-trivial tasks often find the process frustrating if they do not have solid understanding of the language.

If you've used JavaScript for limited, cookbook-style programming tasks, you may be surprised at the depth and detail of JS to be unveiled ahead.

Word Glossary

  • Java - The programming language from Sun Microsystems
  • Netscape -
  • Sun -

If you love this Write-up,

Buy the book from which this is written and inspired:

JavaScript: The Definitive Guide, 5th Edition

References and Further reading.

image.png

Acknowledgement

Dev P Academy