But this is too simple, and it is also too clumsy. To model real life, we need more flexibility with our variables. This introduces the next section of JavaScript, the operator. Operators An operator acts upon a variable and changes its value. This offers more control than manually setting a variable ourselves.
Most operators are mathematical, i.e. they only work on number variables.
Use of operators is generally very easy. Try changing the values of money and spend to get different results. You will also notice how we must use numbers for the variables rather than strings if we want to use operators on them. This is typical, strings do not readily yield to subtraction, '100 dollars' - '50 dollars' is fairly meaningless to a computer because there are letters involved. We can perform string addition though.