DEV Community

Sundar Joseph
Sundar Joseph

Posted on

JavaScript Syntax day-1 (discuss)

JavaScript syntax is the set of rules, how JavaScript programs are constructed:
// How to create variables:
var x;
let y;

// How to use variables:
x = 5;
y = 6;
let z = x + y; JavaScript Values

The JavaScript syntax defines two types of values:

Fixed values
Variable values
Enter fullscreen mode Exit fullscreen mode

Fixed values are called Literals.

Variable values are called Variables.
JavaScript Variables

In a programming language, variables are used to store data values.

JavaScript uses the keywords var, let and const to declare variables.

An equal sign is used to assign values to variables.

In this example, x is defined as a variable. Then, x is assigned (given) the value 6:
JavaScript Keywords

JavaScript keywords are used to identify actions to be performed.

The let keyword tells the browser to create variables: JavaScript Expressions

An expression is a combination of values, variables, and operators, which computes to a value.

The computation is called an evaluation.

For example, 5 * 10 evaluates to 50: JavaScript Identifiers / Names

Identifiers are JavaScript names.

Identifiers are used to name variables and keywords, and functions.

The rules for legal names are the same in most programming languages.

A JavaScript name must begin with:

A letter (A-Z or a-z)
A dollar sign ($)
Or an underscore (_)
Enter fullscreen mode Exit fullscreen mode

Subsequent characters may be letters, digits, underscores, or dollar signs.

Top comments (0)