There are lots of built-in objects in JavaScript. You've used some of them, such as arrays:
let arr = [1, 2, 4, 8, 16];
console.log(arr);
and functions (yes, they are objects):
function sum(a, b) {
return a + b;
}
Here are some common objects worth introducing:
Number, String. Boolean)Wrapper object types (Number, String, Boolean) serve as object "versions" of their corresponding primitive type.
We can declare and initialize them as we would declare any other object type:
let firstName = new String("Mark"), lastName = new String("Smith");
// same as
let firstName = "Mark", lastName = "Smith";
Wrapper objects can be used in a similar fashion to their corresponding primitive type (i.e. concatenation on String objects):
let firstName = new String("Mark"), lastName = new String("Smith");
let name = new String("");
name = firstName + " " + lastName;
console.log(name, ": Hi!");
However, like many other objects, wrapper objects are far more useful and complex under the hood.