JavaScript – Basic syntax, variables, data
JavaScript – Basic syntax, variables, data
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
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