What is Java Script?
JavaScript is a high-level, interpreted programming language that is primarily used for client-side web development. It is a dynamically typed language, meaning that variables can hold values of different types at different points in the program's execution. JavaScript was created in 1995 by Brendan Eich while he was working at Netscape Communications Corporation.
JavaScript is used to add interactive elements to web pages, such as dynamic styling, animations, and form validation. It is also used to create complex web applications and server-side applications using frameworks like Node.js. JavaScript is supported by all modern web browsers, making it a widely used language for front-end web development.
ECMAScript
ECMAScript is a standardized scripting language that is commonly used for client-side scripting in web browsers. ECMAScript is the specification upon which JavaScript is based, so when people talk about "JavaScript", they are often referring to a specific implementation of ECMAScript. You can think of ECMAScript as a set of rules or guidelines that define the syntax and behavior of the JavaScript language.
How do you add JavaScript to your page?
Internal JS
After writing the HTML just before your closing </head>
tag add:
<script>
// write your JS here
</script>
External JS
create a new file in the same directory as your sample HTML file. Call it script.js
— make sure it has that .js filename extension, as that's how it is recognized as JavaScript.
<script src="script.js"> </script>
Data types
Primitive Data types
String
"Dev" // String value
Numbers
1 23 103 // Number Value
Boolean
true false // boolean value
Undefined
Null
Non - Primitive Data types
Arrays are ordered collections of values, which can be of any data type, including other arrays and objects.
[1, 2, 3, "Dev", "Hashnode"]
Objects are complex data types that can hold multiple key-value pairs. They can be used to represent real-world entities or abstract concepts, and are often used to store and manipulate data in JavaScript.
{ key: "Value", name: "Dev" }