JAVASCRIPT STATEMENTS
A JavaScript statement is a command to the browser.
The purpose of the command is to tell the browser what to do.
This JavaScript statement tells the browser to
write "Hello Dolly" to the web page: document.write("Hello
Dolly");
It is normal to add a semicolon at the end of each
executable statement. Most people think this is a good programming practice,
and most often you will see this in JavaScript examples on the web.
The
semicolon is optional (according to the JavaScript standard), and the browser
is supposed to interpret the end of the line as the end of the statement.
Because of this you will often see examples without the semicolon at the end.
JavaScript Arithmetic Operators
Arithmetic
operators are used to perform arithmetic between variables and/or values. Given
that y=5, the table below explains
the arithmetic operators:
JAVASCRIPT OPERATORS
= is used
to assign values.
+ is used
to add values.
The
assignment operator = is used to
assign values to JavaScript variables. The arithmetic operator + is used to add
values together.
y=5;
z=2;
x=y+z;
The value
of x, after the execution of the statements above is 7.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.