Professional Documents
Culture Documents
B. Using Variables
Variables can be used across any location in a script.
Any changes to a variable (such as its value) will be reflected to any location in the
script that uses the variable.
C. Naming Variables
Variables follow certain rules and conventions for their naming:
o The first character MUST BE a letter, an underscore (_), or a dollar sign ($).
Subsequent characters may be letters, digits, underscores, or dollar signs.
o Numbers are NOT allowed as the first character for the identifier’s name.
o Variable names CANNOT include a mathematical or logical operator in the name
(for example, 2*something or this+that;).
o Variable names MUST NOT contain spaces.
o Hyphens are NOT allowed to be used in JS variables; the hyphen symbol (-) is
reserved as the subtraction operator.
o Variables MUST NOT have special symbols, such as the pound sign (#), the
percent symbol (%), etc.
o Variables MUST NOT use any reserved words as they have uses in other aspects
of JS programming.
SoloLearn
SoloLearn
SoloLearn
These are symbols used to perform arithmetic functions on numerical values, such as those
on variables and literals.
o The addition operator is denoted by the plus sign (+). It is used to add two (2) or more
operands and return the resulting value.
o The subtraction operator is denoted by the hyphen (-). It is primarily used to subtract
the value of the second operand from the first operand.
o The multiplication operator is denoted by the asterisk (*). It is used to multiply an
operand with another.
o The division operator is denoted by the forward slash symbol (/). It is used to perform
division operations between two (2) or more operands.
o The modulus operator is denoted by the percent symbol (%). It is used to return the
remainder from a division operation of two operands.
SoloLearn
The increment operator is denoted by two plus signs (++). It is used increase the
numeric value of its operand by one (1). If placed before the operand, it returns the
incremented value. If placed after the operand, it returns the original value and then
increments the operand.
The decrement operator is denoted by two hyphens (--). It is used to decrease the
numeric value of its operand by one (1). If placed before the operand, it returns the
decremented value. If placed after the operand, it returns the original value and then
decrements the operand.
SoloLearn
V. Comparison Operators
SoloLearn
These are operators used in logical statements, which determine equality or difference
between given variables and/or values.
The can only return Boolean values: true or false.
SoloLearn
References:
SoloLearn. (n.d.) JavaScript Tutorial. Retrieved on April 6, 2018 at
https://www.sololearn.com/Course/JavaScript/
SoloLearn. (n.d.) jQuery Tutorial. Retrieved on April 6, 2018 at
https://www.sololearn.com/Course/jQuery/