Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 976 Bytes

README.md

File metadata and controls

41 lines (33 loc) · 976 Bytes

Chapter 2- Program Structure

Expressions and Statements

  1. A fragment of code that produces a value is called an expression.
  2. Every value that is written literally is called an Expression. For example:
22
"Saturday"
  1. An expression between parentheses is also an expression.

The simplest kind of statements is an expression with a semicolon after it.

1;
true;

Bindings

To catch and hold values, JavaScript provides a thing called a binding or variable

let caught = 5 * 5;
console.log(caught);
// -> 10

The = operator can be used anytime to change values from the bindings. Imagine Bindings or Variables is a tentacle not Boxes. They do not contained values but they grasp them. Example:

let sayudhaDebt = 20;
sayudhaDebt = sayudhaDebt - 5;
console.log(sayudhaDebt);
// -> 15;

if a variable or binding has no value, you'll get the value undefined