HTML: Creates the structure of a web page. (markup language) CSS: Adds design to web pages. (style rule language) JavaScript: Makes web pages move dynamically. (script language)
What is JavaScript?
JavaScript is an interpreter language and object-based scripting programming language for the web. By selecting a specific element(s) of HTML, you can put a function to perform a certain action according to various events (mouse click, keyboard input, etc. ) You can manipulate HTML, CSS, and more.
History of JavaScript
JavaScript was created in 1995 by Brendan Eich of Netscape. It was initially developed under the name Mocha, but later changed to Live Script and finally to JavaScript.
Features of JavaScript
JavaScript is an object-based scripting language.
JavaScript is a dynamic, interpreted language that doesn't require you to specify a type.
JavaScript can express both object-oriented programming and functional programming.
JavaScript execution order
In general, JavaScript is executed in the order from top to bottom. This means that you have to write your code carefully in order. (However, there are exceptions due to hoisting.)
JavaScript engine
Browsers have a built-in engine called the JavaScript Virtual Machine .
Chrom , Opera - V8
Firefox - SpiderMonky
IE - Trident and Chakar
Microsoft Edge - ChakraCore
Safari - Nitro and SquirrelFish
How the JavaScript virtual system engine works
1. The engine reads the script.
2. Convert the script to machine language.
3. Make your code run faster.
Advantages and disadvantages of JavaScript
Advantages
No compilation process required > Script code can be written in a short time.
Compared to other languages, it has a simple structure and principle, making it easy to learn.
Because it is a web-specific technology, it works well and has high scalability regardless of operating system or platform.
disadvantage
There is no direct access to the OS.
The hard disk cannot be read or written.
You cannot call other programs.
JavaScript cannot communicate between tabs/windows except for two tabs/windows with the same domain.
Because JavaScript runs in a web browser, it has some security restrictions, and you need to ensure that opening a web page in the browser is safe and unhindered.
In general, JavaScript can send unrestricted network requests only to its own domain.
The Role of JavaScript
A common use of JavaScript is to add functionality to web pages to make HTML pages dynamic.
What JavaScript can do
Changing HTML pages and adding or removing HTML elements and content
Change the style of CSS and HTML elements
User interaction, form validation
Running scripts for mouse and keyboard events
Setting and viewing of web browser control, cookies, etc.
Communication with web server using AJAX technology
Java vs JavaScript
Although it is easy to think of them as related languages ​​by name, in fact, the two languages ​​are not directly related to each other, and the reason why there is a similarity in grammar is because the grammars of both languages ​​are based on C language .JavaScript standard
JavaScript standard
In 1996, Netscape submitted JavaScript to the European Computer Manufacturers Association (ECMA) to make it an international standard. As a result, ECMA established a new standard called ECMAScript, and published its first version, ECMA-262, in 1997.
ECMAScript becomes an international standard that not only JavaScript but also Microsoft's JScript and Adobe's ActionScript follow.