In JavaScript not every data is an object. There exist a few primitive types, like strings, numbers and Boolean which are not objects. For each of these types there exists a
What is the advantage of keeping two separate representations for numbers, strings and Booleans?
Performance
In what context could one need the distinction between primitive types and objects?
Coercion comes to mind. 0 == false while new Number(0) != false
So for instance:
var a = new Boolean(false);
if(a) {
// This code runs
}
but
var a = false;
if(a) {
// This code never runs
}
You can read more about coercion here: JavaScript Coercion Demystified