JavaScript Syntax & Statements

A JavaScript program is a list of statements to be executed by a computer.

The first example uses variables x (5), y (6) and z and ands x + y to get z and display it

JavaScript Numbers

The Next Example below is Numbers, they can be written with or without decimals.

JavaScript Strings

Next example is for Strings, they can be written with double or single quotes.

JavaScript Operators

JavaScript uses arithmetic operators to compute values (just like algebra), in this case 5 + 6 * 10.

Assigning JavaScript Values

In JavaScript the = operator is used to assign values to variables, in this case 'demo4' by = 5 + 6.

JavaScript Expressions

Expressions using 'constants' compute to values, in this case 'demo5' element is assigned by = 5 * 10.

JavaScript Expressions with Strings

Expressions compute to values, or concatenate 'John', ' ' and 'Doe'.

JavaScript Expressions

Expressions compute to values, contants (10) and variable (c).

The var Keyword Creates Variables (d [5 + 6] and e [d * 10])

JavaScript is Case Sensitive so Take care in the code!

Try to change lastName 'Doe'to lastname 'Peterson' or not checking case when referencing a variable.