- 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?
The need to store multiple variable types (values) within a single variable
- What variable type can be used in order to solve the problem of storing multiple values?
We can use arrays to store multiple values and access them as they are.
- What are properties in Javascript?
They are certain characteristics of a value in Javascript.
- Which values do not have properties?
Null and undefined
- How can we access properties in a value (two ways)?
Value.x or value[âxâ]
- What are methods?
âProperties that contain functions are generally called methods of the value they belong to, as in âtoUpperCase is a method of a stringââ
- What are objects?
An arbitrary collection of properties
- 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)?
They can store sequences of things. Basically they can store several types of data inside one object
- How do you define an object?
Using curly brackets in an expression then inside the bracket { state a name of a property then a colon : then give it a value then a comma , and state the next name then colon : value etc. etc then close curly bracket }
- What can you say about the mutability of Javascript objects?
Unlike numbers, strings and Booleans (which are immutable) objects have mutability (can be changed) and have different content at different times.
Now youâve probably come to the sub-chapter called The lycanthropeâs log. Skip this chapter if you want as it for some reason introduces a lot of math which is completely unnecessary at this point.So feel free to jump to the sub-chapter called Strings and their properties.
Think about the following questions:
- Why canât you add new properties to a string variable?
Because they are immutable (unlike objects which can be added to)
- What are rest parameters?
They can only go at the end (must be the last parameter in a functionâs definition) and a rest parameter tells Javascript to place all the remaining parameter (that the programmer gave it) in a standard array. This allows them to be used in succession without having to individually list them all.
- (Feel free to skip the sub-chapter of Math object and Destructing)
- What is serialisation and what is a use case of serialisation of data?
When we convert our data to a flat description. For instance if i wanted to send
- What is JSON?
JavaScript Object Notation - data storage and communication format on the web (even used in other languages beyond javascript)
- What are the differences between JSON and the way programmers write objects in plain Javascript?
In JSON there are no function call, bindings or anything that requires computation allowed and it must be written with â double quotes not single â .
You use JSON.stringify(JavaScript String) to turn a regular JAvaScript value into a JSON-encoded string
You use JSON.parse(string) to convert back to the value you encoded with the .stringify command