Arithmetic Operators

You use arithmetic operators to perform operations between variable and direct values. Table 2.1 shows a list of the arithmetic operations, along with the results that are applied.

Image

Table 2.1 JavaScript’s arithmetic operators, with results based on y=4 initially


Note

You can also use the + operator to add strings or to add strings and numbers together. It allows you to quickly concatenate strings as well as add numerical data to output strings. Table 2.1 shows that when you add a numerical value and a string value, the numerical value is converted to a string and then the two strings are concatenated.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.255.249