0% found this document useful (0 votes)
4 views

JavaScript – Basic syntax, variables, data

Uploaded by

The Programmer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

JavaScript – Basic syntax, variables, data

Uploaded by

The Programmer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

JavaScript – Basic syntax,

variables, data types


Syntax - Statements

 JavaScript code is composed of statements. These are like instructions that tell the
computer what to do.
Syntax - Comments

 Comments are used to add explanations within the code. They are ignored by the
computer when the code is executed. You can write single-line comments using // or
multi-line comments using /* */.
Syntax – Case Sensitivity

 JavaScript is case-sensitive. This means that ‘variableName’, ‘VariableName’, and


‘variablename’ would all be considered different variables.
Variables

 Variables are used to store data that can be manipulated and referenced in a program.
In JavaScript, there are three ways to declare variables: var, let, and const.
Var

 ‘var’ is the old way of declaring variables in JavaScript. It has some quirks and is
generally not recommended for modern JavaScript development.
let

 ‘let’ is the preferred way to declare variables in modern JavaScript. It allows you to
declare variables that can be reassigned later.
Const

 ‘const’ is used to declare variables that cannot be reassigned. Once a value is


assigned to a const variable, it cannot be changed.
Data types - Numbers
Data types – String
Data types - Boolean

Booleans: Represents true or false values.


Data types - Undefined

Undefined: Represents a variable that has been declared


but has not been assigned a value.
Data types- Null

Null: Represents the intentional absence of any object value.

You might also like