JS Data Types or JavaScript Data Types
string- a character or a string of characters
number- an integer or floating-point number
boolean- a value with true or false.
function- a user-defined method
object- a built-in or user-defined object
Ex
1 2 3 4 5 6 7 |
var mystring= "I am a string"; var myinteger=168; var myfloat=12.88; var mybool=true; |
Explanation:
var mystring=”I am a string”; // mystring data type is a string.
var myinteger=168; // myinteger data type is a number.
var myfloat=12.88; // myfloat data type is a number.
var mybool=true; //mybool data type is boolean.
Note: Double quotes are always used in the string. e.g. “abcde”, “learning”.