JS is single thread language with asynchronous events and callbacks functions for performance. Unlike Other scripting languages, it is very fast as modern web browsers use Just in Time compilers with First Class Functions.
- Frontend Development
- Backend Development
- Software Development
- Mobile Apps Development
- Web Animations
- AR and VR
- 2D and 3D
The same time, Microsoft also invented JScript, the Microsoft's client side scripting language for their Internet Explorer 3. But JScript was meant for Internet Explorer only.
Timeline of Web Technologies
|1991||HTML, WWW Formed|
|1997||ECMA 1||First Edition|
|1997||ECMA 2||Some Editorial Changes|
|1999||ECMA 3||Add Regular Expressions, Try Cache, new string handlers.|
|2009||ECMA 5||Add Strict Mode, getter and setters, JSON and More features in Objects.|
|2011||ECMA 5.1||ECMA Standards are fully aligned with 3rd Edition of ISO/IEC.|
|2015||ECMA 6||Also known as ES2015, adds Classes and Modules, let & const, Arrow functions and Promises.|
|2016||ECMA 7||Also known as ES2016, includes two new features: the exponentiation operator (**) and Array.prototype.includes.|
|2017||ECMA 8||Also known as ES2017 includes await/async, which works using generators and promises.|
|Chrome V8||Google Chrome, Chromium, New Microsoft Edge||Node JS, Deno|
|SpiderMonkey||Firefox, Netscape Navigator||MongoDB 3.2 and above, Adobe Acrobat and Reader, CouchDB|
|Chakra||Internet Explorer, Edge|
Here are the examples with code.
<script> tag. See example
<button onclick="alert('Hello JS')">Check</button>
<script> tag. When Webpage loads, script code executes and can slow down page speed.
<script> var x="hello string"; console.log(x); </script>
<script> console.error("error found"); </script>
Alert box, i.e alert() or window.alert() is used to show output in dialog box. For alerts , use alert(). Alert generally block the code, thus next code block will run only after alert is closed.
<script> var x="hello js"; alert(x); </script>
prompt() or window.prompt() dialog box is used to receive input from user. The default datatype of prompt object is string. But id cancelled, it will return null.
<script> var x=prompt("Enter Name"); alert(x); </script>
confirm() or window.confirm() dialog box is used to get confirmation from user. This will show ok or Cancel in dialog box. ok will return true and cancel will return false.
<script> var x=confirm("Press Ok or Cancel"); alert(x); </script>
JS Dialog box block JS code till they are closed. Do not use JS Dialog box in production code. Use dialog boxes only for testing purpose.
In Firefox, there is a option to avoid multiple dialog boxes.
//. This will comment only right hand side of code.
<script> // single line comment </script>
/* opening and
*/ closing, same like css comments.
<script> /* Multi-line Comment */ </script>
Noscript Tag use