- String: Any string of text.
- Boolean: True or False.
- Undefined: The default state of a variable before a value is assigned to it.
- Null: Equivalent of nothing.
Examples of other data types which are not classified as ‘primitive’ data types would be objects or arrays
String blogName = "ConquerJS";
If I changed my blog’s name to a number I loved for some reason, like 3456729, in Java, I could not change ‘blogName’ to that number. I would have to create a new “int” variable to hold my new blog name (Of course I could always make the new numeric blogName a string by wrapping it in quotes).
var blogName = "ConquerJS";
blogName = 15; <---- This works, my variable now holds a number.
var name = "rup";
var age = 50;
var handsome = false;
I can add them together like
console.log(name + age + handsome);
This will evaluate to a string, since you can’t turn a string into a number most of the time because words are not numbers, but numbers can always be strings, as can Booleans.