manual.
md 8/7/2023
Javascript Manual
1. Introduction to Javascript
What is Javascript?
History and evolution of Javascript
Setting up the development environment
2. Javascript Basics
Variables and data types
Operators
Control flow (if statements, loops)
Functions
Objects and arrays
1/6
manual.md 8/7/2023
1. Introduction to Javascript
What is JavaScript ?
JavaScript is a versatile and widely-used programming language primarily used for creating interactive and
dynamic elements on websites. It plays a pivotal role in front-end web development, enabling developers to
enhance user experiences by adding functionality, handling user interactions.
Role of Javascript in Web Development
2/6
manual.md 8/7/2023
History and evolution of Javascript
3/6
manual.md 8/7/2023
Setting up the development environment
2. Javascript Basics
4/6
manual.md 8/7/2023
Variables and data types
JavaScript Data Types: Primitive and Reference Types
Variables and Declaration:
Variables are named containers used to store data values. In JavaScript, you can declare variables using
the var, let, or const keywords.
var was traditionally used for variable declaration but has some scoping quirks.
let is a block-scoped variable declaration that allows reassignment.
const is also block-scoped but enforces immutability after the initial assignment.
Here's how you declare variables:
// Using var (avoided in modern JavaScript due to scoping issues)
var age = 25;
// Using let (reassignable)
let name = "John";
// Using const (immutable)
const pi = 3.14159;
Code Samples:
. Declaring and using primitive type variables:
let age = 30;
let name = "Alice";
let isActive = true;
let salary = null;
console.log(age); // Output: 30
console.log(name); // Output: Alice
console.log(isActive); // Output: true
console.log(salary); // Output: null
Data Types
JavaScript data types can be categorized into two main groups: primitive types and reference types.
Understanding these distinctions is crucial for effective programming.
Primitive Types:
. Number: Represents numeric values, including integers and floating-point numbers.
. String: Represents sequences of characters, such as text.
. Boolean: Represents true or false values.
. Undefined: Denotes a variable that has been declared but hasn't been assigned a value yet.
5/6
manual.md 8/7/2023
. Null: Represents an intentional absence of any value.
. Symbol: A unique and immutable data type introduced in ECMAScript 6.
Reference Types:
. Object: Represents a collection of key-value pairs, where keys are strings (or symbols) and values
can be of any data type.
. Array: Represents an ordered list of elements, with each element accessible by an index.
. Function: Represents a reusable block of code that performs a specific task.
. Date: Represents a specific moment in time.
. ...and more: JavaScript also includes other reference types like RegEx, Map, Set, and Promise.
6/6