What you should already know to learn Javascript ?
This tutorial assumes that you have the following basic background:
- A general understanding of the Internet and the World Wide Web (WWW).
- Good working knowledge of HyperText Markup Language (HTML).
What is JavaScript ?
JavaScript (JS) is a dynamic programming language that can help in adding interactivity to a website.
Features of JavaScript
- cross-platform (works on multiple operating systems or devices), object-oriented scripting language
- lightweight, because it runs in an interpreter (executes code line by line).
- interpreted (just-in-time compiled programming language).
- versatile and beginner-friendly.
- dynamic programming language (runtime operations can be done instead of compile-time). For example, it is possible to change the type of a variable or add new properties or methods to an object while the program is running.
- case-sensitive and uses the Unicode character set
A simple example with "Alert Box"
We have a button called "Click Me", which has an "onclick" attribute which fires on a mouse click on the button element. This event calls the "helloRider" function
We wrote the function "helloRider" within a script
tag, contains single line of code,
alert("Hello Binary Rider !")
.
This triggers the alert box and freezes any other actions in the user interface (UI).
Execution Order
When a block of JavaScript code is encountered, then the sequence of execution would be from top to bottom