Tuesday.
Arithmatic operaters
Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
++ Increment
-- Decrement
JavaScript String Operators
The + operator can also be used to add (concatenate) strings.
<p id="demo"></p>
<script>
var txt1 = "John";
var txt2 = "Doe";
document.getElementById("demo").innerHTML = txt1 + " " + txt2;
</script>
John Doe
The += assignment operator can also be used to add (concatenate) strings:
<script>
txt1 = "What a very ";
txt1 += "nice day";
document.getElementById("demo").innerHTML = txt1;
</script>
What a very nice day
JavaScript Comparison Operators
Operator | Description | ||||||
---|---|---|---|---|---|---|---|
== | equal to | ||||||
=== | equal value and equal type | ||||||
!= | not equal | ||||||
!== | not equal value or not equal type | ||||||
> | greater than | ||||||
< | less than | ||||||
>= | greater than or equal to | ||||||
<= | less than or equal to | ||||||
? | ternary operator |
Data types
Primitive Data
A primitive data value is a single simple data value with no additional properties and methods.The typeof operator can return one of these primitive types:
- string
- number
- boolean
- null
- undefined
Complex Data
The typeof operator can return one of two complex types:- function
- object
No comments:
Post a Comment