-
Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
We need to store data that is easily mutable and accessible. It’s impossible to do that with strings
-
What variable type can be used in order to solve the problem of storing multiple values?
We can use arrays or objects
-
What are properties in Javascript?
Properties are attributes that are contained in an object
-
Which values do not have properties?
Null and undefined
-
How can we access properties in a value (two ways)?
Object.x, object[x]
-
What are methods?
Properties that contain functions are called methods.
-
What are objects?
You take a single value and assign it to a list of multiple properties that you can
access by calling the key or name of the property -
What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
To access the property, we only need to know the name and not the position, like we would have to in an array. We can also easily edit and remove data, with integers, strings, and booleans we do not have the ability
-
How do you define an object?
var object = { }
-
What can you say about the mutability of Javascript objects?
They are very mutable
Part 2
-
Why can’t you add new properties to a string variable?
Because they are immutable
-
What are rest parameters?
A rest parameter allows indefinate number of arguments as an array
-
(Feel free to skip the sub-chapter of Math object and Destructing)
Skipped
-
What is serialisation and what is a use case of serialisation of data?
It helps to convert memomory addresses and other data to flat format so other computer can read it, where you left off
-
What is JSON?
JSON is a way to seralize data, it is a data storage and a communication format on the Web, can be used with other languages besides JS
-
What are the differences between JSON and the way programmers write objects in plain Javascript?
Everything needs to be surrounded by double quotes and only simple data expressions are allowed, comments are not allowed either