Get to know the island Primitives
Now, there are different kinds of value islands. First, we need to understand the islands that exist in the natural world.
These 'natural' islands are called 'primitives'.
When I think of the word primitive, I think of ‘primates’. It helps me remember that these follow the laws of nature.
What are these laws?
- They can’t be mutated. Primitive values cannot be directly changed or tampered with.
- You can never have two of the same thing. In the world of JavaScript, you cannot have two values for the number
2, or the string'Hello World'. There can only ever be one of these. This is different to objects, arrays and functions, as we will soon see.
The bottom line is: we can’t play god. Every single number, every single string you can think of, is produced by the engine itself. All we can do is find them and use them in our code. Even 'Hello' + 'World' doesn’t change either string - the + operator finds us a new one: 'Hello World'.
Let’s meet the primitive islands. These illustrations are just for fun, and may help you remember their names.







