1.JavaScript operator
operator = is used to assign a value.
operator + is used to add values.
y=5; z=2; x=y+z;
1.1 + Operators for strings
The + operator is used to add a literal value or a string variable (to join together).
If you want to concatenate two or more string variables, use the + operator.
txt1="whata very", txt2="Nice Day"; txt3= TXT1+TXT2;
The results of the TXT3 operation are as follows:
What a Verynice Day
1.2 Adding arithmetic to strings and numbers
Two numbers are added, the sum of the numbers is returned, and if the number is added to the string, the string is returned as follows:
x=5+5; y="5"+5; z=" Hello"+5;
x,y, and z output results are:
Ten - Hello5
2.JavaScript comparison and logical operators
Comparison and logical operators are used to test for true or false.
2.1 comparison operators
Comparison operators are used in logical statements to determine whether a variable or value is equal.
X=5, the following table explains the comparison operators:
2.2 Logical operators
Logical operators are used to determine the logic between variables or values.
Given X=6 and y=3, the following table explains the logical operators:
2.3 Bar Operators
JavaScript also includes conditional operators that assign values to variables based on certain conditions.
JavaScript comparison and operator (i)