Booleans represent truth values used to control whether code runs. Strings provide .startsWith() to test beginnings and arrays provide .includes() to test membership. JavaScript separates primitive values (undefined, booleans, numbers, strings) from objects (such as arrays). Primitive values are stored directly in variables. Objects are compound structures that contain values and are compared by identity rather than by value. Arrays and other objects are created on the heap and referenced by a variable that holds the object's unique identity.
This blog post is part of the series "Learning web development" - which teaches people who have never programmed before how to create web apps with JavaScript. To download the examples, go to the GitHub repository learning-web-dev-code and follow the instructions there. I'm interested in feedback! If there is something you don't understand, please write a comment at the end of this page.
Before we can learn more, we need to explore a little bit of theory - because that helps us understand what comes later. JavaScript makes an important distinction: On one hand, there are primitive values such as undefined, booleans, numbers, and strings. On the other hand, there are objects such as arrays. Primitive values A primitive value is: If we assign a primitive value to a variable, it is stored in that variable.
Collection
[
|
...
]