JavaScript is a high-level, interpreted programming language that is primarily used to make web pages interactive and dynamic.
In Web Development JavaScript is primarily used for enhancing the interactivity and functionality of websites. It runs in the browser and allows you to manipulate the Document Object Model (DOM), handle events, and create dynamic content.
<script type="text/javascript">
var a;
Var b;
</script>
var x = 5; // Declaring a variable (older way, not recommended)
let y = 10; // Declaring a variable with block scope
const z = 15; // Declaring a constant variable
Variable types: string, number, boolean, array, object, function, etc.
// This is a single-line comment
/*
This is a
multi-line comment
*/
let str = "Hello"; // String
let num = 42; // Number
let isTrue = true; // Boolean
let arr = [1, 2, 3]; // Array
let obj = { key: "value" }; // Object