-
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?
They can’t store multiple values (data) for one variable (day). -
What variable type can be used in order to solve the problem of storing multiple values?
Arrays. -
What are properties in Javascript?
Properties can access information about a value. -
Which values do not have properties?
Null and undefined. -
How can we access properties in a value (two ways)?
Both value.x and value[x]
access a property on value—but not necessarily the same property.
Whereas value.x fetches the property of value named “x”, value[x]
tries to evaluate the expression x and uses the result, converted to a string, as the property name. -
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”.
Ex.
let day1 = { squirrel: false, events: ["work", "touched tree", "pizza", "running"] };
-
What are objects?
Values of the type object are arbitrary collections of properties. One way to create an object is by using braces as an expression. -
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)?
Objects can store multiple different data types. -
How do you define an object?
let Object = { Name1: value1, Name2: value2, .... }
- What can you say about the mutability of Javascript objects?
We saw that object values can be modified. The types of values discussed in earlier chapters, such as numbers, strings, and Booleans, are all immutable.
SECOND PART:
-
Why can’t you add new properties to a string variable?
Values of type string, number, and Boolean are not objects, such values are immutable and cannot be changed. -
What are rest parameters?
The rest parameter is bound to an array containing all arguments, If there are other parameters to either side of it, the rest parameter will take only the arguments in between. -
(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?
Serialisation converts Data into flat description. It allows you to save data in a file for later or send it to another computer over the network -
What is JSON?
A popular serialization format is called JSON (pronounced “Jason”), which stands for JavaScript Object Notation. It is widely used as a data storage and communication format on the Web, even in languages other than JavaScript. -
What are the differences between JSON and the way programmers write objects in plain Javascript?
All property names have to be surrounded by double quotes, and only simple data expressions are allowed—no function calls, bindings, or anything that involves actual computation. Comments are not allowed in JSON.