Javascript
Javascript
1. What is JavaScript?
• JavaScript is a high-level, versatile, and dynamic
programming language primarily used for building
interactive web pages and web applications.
• It's often referred to as the "language of the web"
because it's the most common scripting language used
in web development.
2. History of JavaScript:
• Developed by Netscape Communications Corporation,
led by Brendan Eich in 1995.
• Initially named "LiveScript" but later renamed JavaScript
for marketing purposes.
• Standardized as ECMAScript.
3. JavaScript in Web Development:
• JavaScript is primarily used to enhance the functionality
of web pages by adding interactivity and dynamic
behaviour.
• It can be embedded within HTML code and executed by
web browsers.
4. Features of JavaScript:
• High-level language: JavaScript abstracts many of the
low-level details, making it easier to write and
understand code.
• Interpreted: It's executed by the web browser without
the need for compilation.
• Dynamic and loosely typed: Variables can change types,
and you don't need to specify types explicitly.
• Object-oriented: JavaScript is centered around objects
and supports object-oriented programming.
• Cross-platform: Runs on all major web browsers and
platforms.
Variables in JavaScript:
Example:
2. let:
o let allows you to declare block-scoped variables,
which means they are only accessible within the
block (e.g., inside a function or loop) where they
are defined.
Example:
3. const:
o const is used to declare constants. Once a value is
Example:
a. String:
c. Boolean:
• Represents true or false values.
Example:
d. Undefined:
e. Null:
• Represents the intentional absence of any object value.
Arithmetic Operators:
Comparison Operators:
4. Strict Not Equal (!==): Checks if two values are not equal
or have different data types.
6. Less Than (<): Checks if the left value is less than the
right value.
7. Greater Than or Equal (>=): Checks if the left value is
greater than or equal to the right value.