JavaScript Tutorial For Beginners

Last Updated on 13 August 2020

JavaScript is one of the most widely used programming language over the decades. In the past, JavaScript mainly use for front end development.

Since web development technologies keep improving, the JavaScript nowadays not only just use on front-end web development. You can also able to use it for back end development like node.js or even use it to build mobile app with react native.

What is JavaScript?

JavaScript is a primary programming language that uses across almost all the website. In other words, it also abbreviated as JS. JavaScript can dynamically change and update contents of the website.

JavaScript is an Interpreted Language

JavaScript is an interpreted language, it is not a compiled language. You don’t need to complied the code in order to run JavaScript code. A compiled language like C++ or Java need to be compiled and convert into bytecode that the machine understands and can execute.

However, JavaScript doesn’t need to be compiled before it can be execute. But, it required a browser to interprets the code. You can run and test the JavaScript code directly with a browser without compiled. The browser will interprets the code line by line and execute it.

JavaScript is NOT JAVA

I always heard many beginners misunderstood about JavaScript and Java. Lots of beginners think they are the same thing. However, JavaScript is not Java and Java is not the acronym of JavaScript.

They both are completely differenced programming language. Don’t be confuse, JavaScript and Java are not the same programming language. JavaScript is also not the script version of Java Programming Language.

What JavaScript Can Do?

  • It is well-suited for performing task within a web browser.
  • Most common uses of JavaScript are interacting with users, getting information from them and validating their actions.
  • With JavaScript, you can easily change HTML content, HTML styles, HTML attributes.
  • It can easily detect what browser a person is using and customize the web pages to their browser.
  • Form validation with JavaScript.

Why Learn JavaScript?

  • JavaScript isn’t very hard to start, you can start with a simple computer.
  • It is easy to debug and find errors
  • You don’t need to have a fancy computer, as long as your computer is support web browser.
  • You don’t need to buy any specific hardware in order to run and learn JavaScript, It just requires a browser to interpret.

Setup Working Environment

To learn Javascript, It requires two things for setting up the working environment for JavaScript.

Writing First Program

To get started, a simple JavaScript program is written.

Create A Pop Up Alert Box

alert("Hello, this is Jorcus!");

Test

document.write("Hello, this is Jorcus! This will overwrite");

NOTE: If you running this script after the entire HTML page loaded, it will delete the entire existing HTML and overwrite with new content.

Testing and Debugging

console.log("Hello Jorcus!");

Add Comments To JavaScript:

There are two ways of adding comments to JavaScript.

Single line comments

// Pop up a message to the visitors.
alert("Hello Jorcus!");

Multi line comments

/*
The code below will change
pop up a message with alert box
and an OK button
*/
alert("Hello Jorcus!");

Tips: Adding comments to JavaScript code makes unreadable code more readable.

JavaScript History

The JavaScript is one of the most widely use and popular programming in the world. It’s also known as LiveScript, Jscript or ECMAScript.

The Father of JavaScript

The first appear of JavaScript to the public was back in 1995, it was invented by Brendan Eich of Netscape Communications, he is the founder and the creator of JavaScript programming language.

Netscape LiveScript

JavaScript from Netscape initially were called LiveScript back in September 1995. Then, it change the name to JavaScript after 3 months later.

Microsoft JScript

Microsoft decided to build their own brand of JavaScript and released it in 1996 called JScript.

ECMAScript

Then, Netscape submitted the language to ECMA International in November 1996. ECMA became an independent, and an official standardized edition of JavaScript language.

Leave a Comment