JavaScript Syntax

JavaScript Syntax

JavaScript Values

The JavaScript syntax defines two types of values:

  • Fixed values
  • Variable values
Fixed values are called Literals.
Variable values are called Variables

JavaScript Literals

The two most important syntax rules for fixed values are:
1. Numbers are written with or without decimal
2. Strings are text, written within double or single quotes

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

JavaScript Operators

JavaScript uses arithmetic operators ( + - * / ) to compute values
JavaScript uses an assignment operator ( = ) to assign values to variables

JavaScript Expressions

An expression is a combination of values, variables, and operators, which computes to a value.
The computation is called an evaluation

JavaScript Keywords

JavaScript keywords are used to identify actions to be performed.
The let keyword tells the browser to create variables
The var keyword also tells the browser to create variables

Home

About

Tutorial

EBooks

Menu