01. Javascript Guide – Introduction to Javascript
Introduction to Javascript and the language
In this introduction to Javascript, we are going to discuss the following points.
- Javascript, the language
- Early Javascript
- Characteristics
- Tools
01. Javascript
Initially, Javascript as the name itself was a scripting language for interactive web pages and applications. Now javascript has developed into a complete language that can do almost all of the comprehensive tasks or command that any LISP type language can perform.
A common misconception is, javascript had a connection with Java. Java is a strongly-typed, compile language that doesn’t bring any resemblance to Javascript. It is completely independent of Java.
Javascript is an Object-Oriented Functional language. It has most of the common properties of Object-Oriented principles. But language itself has own way of handling functional concepts.
- Javascript – Initially created for interactive web pages.
- A complete programming language.
- Javascript – completely independent of Java.
- Object-oriented, Functional Language.
You can watch the content of this article from following video as well.
02. Early JS
Earlier, Javascript was known as LiveScript. It had been developed to make web pages more interactive by breaking the programmable barrier between the browser and the content.
Later in different stages, LiveScript became Javascript. At this stage, SUN Microsystem who was owning Java had trademark issues with Javascript. It somehow dragged along with Netscape who were developing Javascript.
Javascript had an equivalent in Microsoft as JScript, which was also known as J++ in later stages.
Currently, ECMA European Computer Manufacturers maintain the Javascript standards. New applications use the latest ECMA 6 standard widely. For the browsers or engines that don’t support the ECMA 6, there are polyfills that provide the functionality need. Babel is the most used polyfill when using javascript.
All together Javascript is a small but complete language that can do operations its own way due to its characteristics.
03. Characteristics
Not precompiled. The source code itself is delivered to run.
Javascript is not a pre-compiled language. The source code will be delivered to be executed. We commonly term these executors as Engines. Some common examples are
- V8 engine – used in Chrome, Opera browsers
- SpiderMonkey – used in Mozilla Firefox.
The engine compiles and runs the code realtime using Just In Compiler or JIT principles. As the words implied, it will compile the code in runtime and reuse it again and again by optimizing on invocation. It’s for the latter part of these tutorials.
Loosely Typed
Javascript is loosely typed. That means you don’t have to explicitly specify the type of variables or objects at the declaration. There are many discussions around this. Supplement language definitions like Typescript have tried to make it type friendly for programmers who need it. On the bottom line, this is the nature of the language you will need to understand and adapt when programming with javascript.
Inheritance by prototype
Javascript uses inheritance by prototyping. It will use the properties of the super objects using prototype chaining. It is a very smart way to exhibit inheritance properties in object-oriented languages.
Dynamic Object Properties
And also, Javascript has dynamic object properties and assignments. You can assign and properties that are not defined on the object creation. Also, you can change the defined properties as well.
Functional and use lambda concepts
Also importantly, Javascript is functional. It uses lambda concepts as a language. Basically you can assign function as attributes of objects and pass them as parameters. This will allow concepts like function currying which we can use very efficiently when programming.
04. Tools you will need
As for the tools, you can run Javascript using the Chrome console. You can easily access it from the developer tools of your Chrome browser.
Chrome > More Tools > Developer Tools (Cmd + Opt + I)
Secondly, you can use Firefox web console which can be useful with multiline scripting.
Tools > Web Developer > Web Console (Cmd + Opt + K)
Other than that you can use SaaS tools like JSBin to work and save your projects on the cloud.
We will be using mostly the Firefox console for Introduction to Javascript tutorials and Vim/VScode for Node.js tutorials.
In the next episode, we will be discussing the data types in Javascript.