Basic Concepts
Chapter: 7 Math operators Arithmetic Operators The name might be a bit of a giveaway but, Arithmetic operators pretty perform arithmetic functions on numbers (both literals and variables). Below you can see the addition operator (+) in action determining the sum of two numbers. var x = 10 + 5; document.write(x); JS Try it Yourself You can add as many numbers or variables together as you want or need to. var x = 10; var y = x + 5 + 22 + 45 + 6548; document.write(y); JS Try it Yourself Heads up! You can get the result of a string expression using the eval() function, which takes a string expression argument like eval("10 * 20 + 8") and returns the result. If the argument is empty, it returns undefined. Arithmetic Operators What will the following statements display? var test=5+7; document.write(test); 5+7 Test 12 Multiplication Want to hear a joke? What tool is best suited for math?...Multi-pliers! JavaScript is pretty good at math too though! We use the * op...