reading-notes

https://mrobeidat.github.io/reading-notes/


Expressions and operators

An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single value. The value may be a number, a string, or a logical value.

For Instance, there are two types of expressions:

1. Those that assign a value to a variable,

2. Those that simply have a value. For example, X=9

Regarding operators there are three types of operators:

  1. Arithmetic: evaluates to a number, for example var x = 100 + 50;
  2. String: evaluates to a character string, for ex :β€œAli” or β€œ123”
  3. Logical: considered as true or false

Functions

When you write a code, you need to do repeat the same action in more than one place, so instead, you can use a function to wrap that code and reuse it

Java script provides many built-in functions for instance, alert() and console.log().

So when you need to declare a function you need to use function word followed by the name of the function for ex:

function square(number){

return number * number; }