Hi all I am stuck on the Sum of a Range exercise its just not clicking so without giving to much away what section of the chapter should I be focusing on? Thanks.
FIRST PART:
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?
It will hold different types. Array
What variable type can be used in order to solve the problem of storing multiple values? Array
What are properties in Javascript? A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure. There are two kinds of properties: Instance properties hold data that are specific to a given object instance. Static properties hold data that are shared among all object instances.
Which values do not have properties?Attributes are defined by HTML. Properties are accessed from DOM (Document Object Model) nodes. While writing HTML code, you can define attributes on your HTML elements.
How can we access properties in a value (two ways)? dot notation and bracket notation.
What are methods? A method is a function which is a property of an object. ⊠Note: In JavaScript functions themselves are objects, so, in that context, a method is actually an object reference to a function.
What are objects? An object is a collection of properties, and a property is an association between a name (or key) and a value. A propertyâs value can be a function, in which case the property is known as a method.
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)? It can handle many different types, not restricted to one.
How do you define an object? There are different ways to create new objects: Define and create a single object, using an object literal. Define and create a single object, with the keyword new . Define an object constructor, and then create objects of the constructed type.
SECOND PART:
What can you say about the mutability of Javascript objects? In JavaScript, only objects and arrays are mutable, not primitive values. ⊠Immutables are the objects whose state cannot be changed once the object is created. Strings and Numbers are Immutable.
Strings variables :
Why canât you add new properties to a string variable? Values of the primitive types are called primitive values and they cannot have properties. Values of the Object non-primitive type are called objects an they can have properties. ⊠© if the value of foo is of the type Number, String or Boolean, then the variable foo will not be changed in any way.
What are rest parameters? Rest parameters are used to create functions that accept any number of arguments. The spread syntax is used to pass an array to functions that normally require a list of many arguments
(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? is the process of translating a data structure or object state into a format that can be stored (for example, in a file or memory data buffer) or transmitted (for example, across a computer network) and reconstructed later (possibly in a different computer environment).
What is JSON? JSON stands for JavaScript Object Notation
JSON is a lightweight format for storing and transporting data
JSON is often used when data is sent from a server to a web page
JSON is âself-describingâ and easy to understand
What are the differences between JSON and the way programmers write objects in plain Javascript?
Object literal syntax is the simplest way to create javascript objects. You can easily create an object using object literal. JSON, on the other hand, is widely used as language independent data transfer format between computer systems.
Greetings @Mrbryce,
You can try going through other studentâs answers in the forum. That is the best way to learn different approaches and logics. The forum topic is here Chapter 4 - Exercises
Hope this helps.
Happy Learning!
Thanks Malik but surely this defect the purpose of the book.
I thought the book would be giving us the actual knowledge and we would be applying this to the exercise at the end of each chapter but this does not seem to be the case or am I missing something.
To be honest I am not happy with the book and how it works maybe because I am misunderstanding how the book works. Any advice you can give would be much appreciated.
-
The problems that can be solved are storing multiple values within the same object. Several variables can be stored within an object which can then affect other values stored within the same object,
-
Arrays can be used in JavaScript to store multiple values.
-
Properties in JavaScript are characteristics and descriptors of values.
-
âNullâ and âundefinedâ values do not have properties.
-
We can access properties by putting a dot or square brackets after the value.
-
Valuesâ methods are properties that contain functions.
-
Objects are a type of value which are arbitrary collections of properties.
-
Objects can have multiple properties, storing several values.
-
You can define an object with the â=â symbol followed with a value.
-
The properties of objects can be changed by code, meaning that they can have different properties at different times. This is what mutability means - the ability to change and modify them. This differs from values such as strings and Booleans, which are immutable.
D E U X I Ă M E P A R T I E
-
You canât add new properties to a string variable because strings are not objects, theyâre values. As such, theyâre immutable in JavaScript.
-
Rest parameters allow programmers to represent an indefinite number of arguments as an array.
-
(
)
-
Serialisation is the conversion of structured data into a format that allows sharing or storage of the data in a form that allows recovery of its original structure. A use case would be saving data in a file in order to read it later or send it to another computer.
-
JSON stands for JavaScript Object Notation.
-
In JSON format 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.
-
You need a streamlined way to represent a collection of different data, for example, in âone containerâ. So strings and integers are simply values of this container.
-
To store multiple values of the same type you can use an array object. If you want to store multiple multiple data/values of different type you can use an object, by defining the object itself and its properties and the corresponding values.
-
Properties are âattributesâ of an object or class, they can be used to store values or functions (in this case theyâre called methods).
-
The values ânullâ and âundefinedâ do not have properties.
-
We can access properties in a value by using the . notation after the value or the [] , again after the value, with inside the property name.
-
They are properties that contain functions.
-
An object is an arbitrary collection of (potentially different) properties.
-
The primitive value types (such as integer, string, array, boolean etc) arenât mutable - e.g. you canât declare 120 = 2 or âcatâ = âratâ. Instead an objectâs properties can be declared and changed. Even an object that has been declared with the const type, while it canât be modified directly throughout the life duration of program, letâs the programmer still be able to modify its properties.
Also objects can be used to store any of those primitive value types.
-
Objects are defined like any other variable. The properties of the objects are given a name, are contained within curly braces and its values assigned after a column.
-
The primitive value types (such as integer, string, array, boolean etc) arenât mutable - e.g. you canât declare 120 = 2 or âcatâ = âratâ. Instead an objectâs properties can be declared and changed. Even an object that has been declared with the const type, while it canât be modified directly throughout the life duration of program, letâs the programmer still be able to modify its properties.
-
You canât add new properties to a string value because itâs not an object type, but a primitive (string) type.
-
rest parameters are a way to allow a function to accept any number of arguments when called.
-
serialization is a way to save data. That way the data can be reloaded and re-utilized because you can store it. Or you can send it to someone and they can use it.
-
JSON - which stands for Javascript Object Notation) is a format that allows data serialization, that is the storing of data and therefore its communication.
-
the difference is the syntax : JSONâs arrays and objects must always be wrapped by ââ and also you canât call functions or variables - that is, any computation is forbidden.
I. 1. The chapter introduces the problem of data traceability - of events that occur to bring to a certain state, result. We have to built a data structure to store such information in the first place.
-
A data type for storing sequences of values is array, written as a list of values between square brackets, separated by commas.
-
Properties in JS are accessed by expressions. Almost all JS values have properties (that define characteristics of values)
-
Exceptions are: null & undefined.
-
We can access properties in a value:
- with a dot: e.g. value.x &
- with square brackets [ ]: e.g. value[x]
-
Methods are properties that contain functions. These are methods of the value they belong to.
-
Objects are a type of value that collects properties; collections of properties.
-
Objects enable us to collect different value types - that in an object represent a random collection of properties.
-
We define/create an object:
- by using braces as an expression,
- inside the braces there is a list of properties separated by commas.
It is possible to assign a value to a property expression with the = operator:
- this will replace a propertyâs value if it already existed or
- create a new property on the object if it didnât.
The delete - unary operator, when applied to an object property will remove the named property from the object (not common, but possible).
- Contrary to the types of values: strings, numbers, arrays and booleans - that are immutable, object values can be modified. We can change their properties (causing a single object value to have different value at different times).
II. 1. We cannot add new properties to a string value because it is not an object (such as values of type number and boolean). Such values are immutable, so cannot be altered.
-
A rest parameter, when a function is called (e.g. function max) is bound to an array containing all further arguments. We use a three dot notation e.g. function max(âŠnumbers) { - to call a function with an array of arguments. It is used for a function that accepts any number of arguments.
-
Serialisation of data is the conversion of data in flat description. We need to do this to be able to save data in a file for later or send them to another computer over the network.
-
JSON:
- is a popular serialisation format,
- widely used as a data storage and communication format on the Web,
- used even in languages other than JS.
- JSON.stringify is JS functions to convert data to this format (a JS value is encoded into a JSON string)
- JSON.parse is JS functions to convert data from this format (the JSON encoded string is returned to the value it encodes).
- In JSON:
- all property names have to be surrounded by double quotes,
- only simple data expressions are allowed,
- no function calls, bindings (anything involving actual computation),
- comments are not alowed.
- The structuring of data that not only consists of strings and integers but also entries that do not consist of just a number or a string like a statement.
- To create an array
- A property is a characteristic of an object, often describing attributes associated with a data structure
- The exceptions are null and undefined
- The two main ways to access properties in JavaScript are with a dot and with
square brackets. Both value.x and value[x] access a property on value - Methods are actions that can be performed on objects
- An object is a collection of properties
- To create an object with statements as properties
- By using {} , everything within the {} are definitions belonging to an object
- numbers, strings, and Booleans, are all immutable, it
is impossible to change values of those types. You can combine them and derive
new values from them, but when you take a specific string value, that value
will always remain the same. Objects work differently. You can change their properties, causing a single object value to have different content at different times
Second Part:
- Only the first assigned properties are stored in the memory
- It is a function to which collects all remaining elements into an array
- JSON is a lightweight programming language for storing and transporting data
- 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.
-
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?
recording a set of activities and the corresponding result. -
What variable type can be used in order to solve the problem of storing multiple values?
object -
What are properties in Javascript?
values have properties(like length for string) that can be accessed by some expressions following a dot. -
Which values do not have properties?
null and undefined -
How can we access properties in a value (two ways)?
with a dot and with square brackets -
What are methods?
Properties that contain functions are generally called methods of the value they belong to -
What are objects?
Values of the type object are arbitrary collections 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)?
provide ways to group several values with different properties into a single value -
How do you define an object?
a set of different value categories, divided and labeled. -
What can you say about the mutability of Javascript objects?
âYou can change their properties, causing a single object value to have different content at different timesâ whereas ânumbers, strings, and Booleans, are all immutableâit
is impossible to change values of those types.â
I canât get it, arrays can be changed as well!!can anybody help out?
SECOND PART: -
Why canât you add new properties to a string variable?
The text inside it cannot be changed -
What are rest parameters?
a way to have a function to accept any number of arguments.
I can get this paragraph âWhen such a function is called, the rest parameter is bound to an array containing all further arguments. If there are other parameters before it, their values arenât part of that array. When, as in max, it is the only parameter, it will hold all arguments.â i will appreciate any explanation -
(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?
data is converted into a flat description -
What is JSON?
â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?
âJSON looks similar to JavaScriptâs way of writing arrays and objects, with a few restrictions. 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â
Hello everyone,
Part One:
- We need a way to store many values and datatypes in a variable to organize the information.
- Arrays
- Properties are ways in which we access the property of a Javascript value
- Null and undefined
- With the dot notation or square brackets eg
value.x
orvalue[x]
- Properties that contain functions are called methods
- Objects are arbitrary collection or properties
- Objects can hold multiple datatypes
- To create objects we use braces
- Javascript objects can be changed
Part two
- Strings are immutable
- In the parameters of a function when itâs denoted by three dots can take any number of arguments when the function is called
- Serialisation is when the data is stored in bits is converted to a flat description
- Javascript Object notation
- Comments, functions, bindings are not allowed in JSON. Only simple expressions are allowed and all property names should have double-quotes.
10. What can you say about the mutability of Javascript objects?
Hello @sajede.k, hope you are OK.
Now, what is exactly what you do not understand?
Mutability is the action that allows an object element to be changed or modified after his declaration.
numbers, strings, and Booleans, are all immutable
meaning that you cant change the variable type, but for example, if an object have a boolean started at false, in the code process this object element can be switch to false if need it for example, but it canât add any extra property.
Example:
var aString = "This is a string";
var bString = aString;
//now we alter aString
aString = "The string has changed";
console.log(aString); //The string has changed
console.log(bString); //This is a string
console.log(aString === bString); //false
Now where is that âinmutabilityâ come from?
The fact that the variables ânumbers, string, booleanâ can only have 1 value at the same moment. You can not add any new property or method to them. While with Objects, they could have new methods added
Example for Objects:
var car = {
color: 'red',
tyres: '4'
}
var anotherCar = car; //here we assign the value of car to anotherCar.
car.color = 'blue'; //we alter a value in the original object
console.log(anotherCar.color); //this shows blue because it is referencing the memory location of the car object.
console.log(car === anotherCar) //true (because comparison is by reference)
12. What are rest parameters?
Few words: the ability to receive infinite amount of arguments to a function.
function multiply(...variables){
var output =1;
for(x of variables){
output*=x;
}
return output;
}
console.log("Multiplication of 2 variables 3 and 5 is "+ multiply(3,5));
console.log("Multiplication of 3 variables 3,2 and 5 is "+ multiply(3,2,5));
Check how you can invoke the same function with many parameters for different scenarios.
Hope this gives you a clear picture of the subject.
If you have any more questions, please let us know so we can help you!
Carlos Z.
PART 1
-
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?
It makes it a lot easier to store data in arrays, particularly data sets. -
What variable type can be used in order to solve the problem of storing multiple values?
The type array can store multiple values. -
What are properties in Javascript?
Some values have properties which describe certain aspects of the value. For instance the âstringâ variable has one property called length which assigns a value corresponding to the number of characters in the string. For arrays the .length property returns the number of elements in the array. -
Which values do not have properties?
The values null and undefined do not have properties. -
How can we access properties in a value (two ways)?
We can access properties with a â.â (for instance Math.max) or square brackets [], such as value[x]. -
What are methods?
A method is a property which contains a function which can be called without any arguments. An example is toUpperCase which returns a string with all the characters converted to uppercase letters:
myString = Hello;
myString.toUpperCase = HELLO;
-
What are objects?
An object is an arbitrary collection of properties, such as height, weight etc which can be defined by the programmer and stored in an array to serve a useful function. -
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)?
An object can have any number of properties of mixed data type.
for instance
let tree = {
name: "Conker",
numberOfLeaves: 123000,
deciduous: true
};
-
How do you define an object?
Objects are defined by using the keyword let, the assignment character (=) and contained in curly brackets. Such asâŠ
let objectA = {a: 1,b: 2,c: 3}
In this case the letters (a,b,c) are the index, the numbers (1,2,3) are the assigned values
-
What can you say about the mutability of Javascript objects?
Javascript objects are defined as being mutable because their properties can be changed, as opposed to variable types such as string and boolean
This means that even if 2 objects have the same value at a given time they are not identical.
let A = {a:1};
let B = {a:1};
A == B
>false
Compare this to type var for instance
var C = 1;
var D = 1;
C==D
>true
This mutability is useful as objects can have different values at different times within a program.
PART 2
-
Why canât you add new properties to a string variable?
You canât add new properties to a string variable because they are immutable, meaning they cannot be changed in the same way objects can. For instance you can change the value assigned to a string, but the text inside it cannot be changed. -
What are rest parameters?
We use rest parameters to define an array which can change size depending on he number of arguments used. For instanceâŠ
function sum(...input){
let add = 0;
for (let i of input){
add+=i; `
}
return add;
}
console.log(sum(1,2)); //3
console.log(sum(1,2,3)); //6
console.log(sum(1,2,3,4,5)); //15
This function will add any number of arguments that is inputted.
-
(Feel free to skip the sub-chapter of Math object and Destructing)
I read this because I like maths. -
What is serialisation and what is a use case of serialisation of data?
Serialisation is a way of converting data into a âflat descriptionâ, meaning the specific memory addresses which are used to store data in one persons computer are converted into a universal code which can be transferred to any other computer. -
What is JSON?
JSON stands for JavaScript Object Notation, and is JSâs way of handling serialisation. It is widely used across the web for data storage and communication, even in languages other than JavaScript. -
What are the differences between JSON and the way programmers write objects in plain Javascript?
Although they look similar there are certain rules which JSON arrays must follow, such as all property names must be surrounded with double quotes and only simple data expressions are allowed. Here is the example above written in JSON:
let tree = {
"name": "Conker",
"numberOfLeaves": 123000,
"deciduous": true
}
Greetings @Mrbryce,
Hope youâre having a great day!
I appreciate your effort going through the book and trying to understand the concepts. There are a lot of concepts introduced here and sometimes it takes time to digest those concepts. However, the later videos in the course use these concepts so you will get familiarised with them all.
Happy Learning!
First part
-
The problems the chapter introduces is that using strings or integers we have to extract the numbers and then convert them back to numbers to access them.
-
The variable type used to store multiple values is an array.
-
Properties are the values associated with a JavaScript object.
-
Null and undefined do not have properties.
-
Two ways to access properties in a value are with a dot notation or with square brackets.
-
Methods are actions that can be performed on objects.
-
An Object is a collection of properties.
-
Objects are Mutable meaning the can change their properties.
-
An object is defined by using brackets.
-
The mutability of JavaScript objects makes them more versatile and usable for various applications.
Part 2
-
You canât add new properties to a string value because they are immutable.
-
Rest Parameters is the last parameter and gathers all the remaining arguments.
-
Serialisation is when an object is converted into a string.
-
JSON stands for JavaScript Object Notation and is a lightweight format for storing and transporting data.
-
The difference with JSON are that property names must be surrounded by double quotes with only simple data expressions with no functions calls, bindings, or any computation. Also comments are not allowed.
- Due to the fact that a single string or integer could be not useful to represent a set of data from different source and of different nature, we need to build up a more complex structure than a simple array of value. This because entries should be number, string or boolean and I would like store them into a unique set. This type of set is an Object which sub-set are the so called properties of that Objects.
- The way to solve the problem is using on Object, a set of different properties useful to give access to more details and data about a variable.
- Properties are usually associated to the attribute of an object. Most of JavaScript values have some property.
- Only ânullâ and âundefinedâ doesnât have any properties.
- There are two way to access a property of an object:
- Using â.â (dot) like âvalue.Xâ, in this case the âXâ is the literal name of the property.
- Using â[ ]â (square bracket) like 'value[X] in this case X is not the literal name of the property. X is use to evaluate the property it refers to.
6.Properties that contain function are called Methods. Some example are â.toUpperCase()â; â.push()â; âpop()â; etcâŠ
- An object is a collection of properties.
- Object can hold different type of data into a complex structure. Each properties can be associated to value of different datatypes all in one into a single data structure.
- Object is a type of value that has a collection of properties written within curly braces.
- In JavaScript string and number are immutable, while objects and arrays are mutable. It is impossible to change the value of a variable, it is possible only to assign a new binding to it. In objects instead we can change a property in order to have an object with different content at different time.
SECOND PART:
- Because a string is a immutable value and not an object, itâs impossible to add a property to it. However strings have predefined properties.
- Rest parameters are such that a function can accept whatever number of arguments. To define such a set of parameter we use the âthree dotâ notation ââŠâ . When a function like that is called, the rest parameter is bound to an array containing all arguments possible.
- Since properties only grasp their specific value, when we need to store object and array we need to store in to the memory addresses of their content. Serialization help to store memory addresses in a more useful way. Converting it in a flat description.
- JSON (JavaScript Object Notation) is a serialization format to communicate and store data on the Web.
- JSON different from JavaScriptâs way to define object and array has to surround the name of the properties between double quotes, and has to use only simple data expression (no function or anything that ask for a computation)
- Although this can be solved with strings or integers but it is awkward. The digits have to be extracted and then converting them back to numbers to access them. This isnât convenient and as mentioned earlier, awkward.
- Arrays
- Properties are the values associated with an object in JavaScript.
- null and undefined
- Dot and square brackets. For example, value.x and value[x]
- Methods are property containing a function definition
- Object is a collection of named values
- The properties in objects can be changed which causes a single object value to have different content at different times. Whereas, boolean, string, etc cannot be modified.
9.var person = {firstName: âBobâ, lastName: âSmithâ, age:30}; - They are addressed by reference and not by value
SECOND PART
- Strings are not objects and immutable
- Rest parameters are used to create functions that accept any number of arguments.
- Converting data into a flat description
- It is a serialisation format that is widely used as a data storage and communication format on the Web, even in other languages than JavaScript
- Comments are not allowed on JSON, all property names have to be surrounded by double quotes, only simple data expressions are allowed (no function calls, bindings or anything that requires computation)
I canât thank you enough.Thatâs very kind of you to take time to explain.
Now it is really clear
1 - It introduces the problem that something can exist in two different forms. Also data structures that can store multiple values and keep the information organized.
2 - Array variable type.
3 - Properties are all kind of different characteristics of value that can access with small expressions.
4 - null and undefined.
5 - In a value using a dot and the literal name of the property (i.e. array.length) or using the square brackets, i.e. array [âlengthâ].
6 - Properties that contain functions.
7 - A data structure that contains a collection of properties.
8 - With one object we can group different value types together into a collection of named values.
9 - How do you define an object?
let object = {
booleanVar = true
stringVar = âIm an stringâ,
arrayVar = [âImâ,âanâ,âArrayâ],
integerVar = 1
};
10 - Unlike numbers, strings and Booleans which are immutable strings, integers, booleans canât be changed. Using objects can change them.
1 - String values are immutable and canât be changed. If you try to set new properties on them, it canât be done because JavaScript doesnât actually store properties.
2 - Rest parameters are bound an array containing all further arguments. They are used to make functions accepts any numbers of arguments.
4 - Serialization means data is converted into a flat description. A popular serialization format is called JSON. The most common use of serialization is when you need to move an object across process, machine.
5 - JavaScript Object Notation, standard text format to share data.
6 - All property names needs to be surrounded in double quotes and only simple data expressions are allowed. So no function calls, bindings, or anything that involves actual computation. Comments are not allowed is JSON.
-
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?
Numbers, strings and booleans are only able to hold a single type of data. Many complex structures which required to store multiple values can not be resolved by such simple variable types. -
What variable type can be used in order to solve the problem of storing multiple values?
Objects and Arrays -
What are properties in Javascript?
Properties are the values associated with a JavaScript object. -
Which values do not have properties?
Null and undefined do not have properties. -
How can we access properties in a value (two ways)?
The two main ways to access properties in JavaScript are with a dot and with square brackets. -
What are methods?
JavaScript methods are actions that can be performed on objects. -
What are objects?
In JavaScript, objects can be seen as a 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)?
Object that stores a list of activities and a Boolean value can not be solved with other value types such as integer, string, array, boolean. -
How do you define an object?
Objects in JavaScript may be defined as an unordered collection of related data, of primitive or reference types, in the form of âkey: valueâ pairs. -
What can you say about the mutability of Javascript objects?
Javascript objects are not immutable. Their properties can be changed causing a single object value to have different content at different times.
SECOND PART: -
Why canât you add new properties to a string variable?
The value of string is immutable, which means it is impossible to modify itâs value by adding new properties. -
What are rest parameters?
Rest parameters are used to create functions that accept any number of arguments. -
(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?
Serialization is a mechanism for storing an objectâs states into a persistent storage like disk files, databases, or sending objectâs states over the network. -
What is JSON?
JSON is a format for storing and transporting data. -
What are the differences between JSON and the way programmers write objects in plain Javascript?
The only noticeable difference is that all names in JSON must be wrapped in double quotes.
Part One.
-
The problems the chapter âWeresquirrelâ introduces that cannot be solved with variable types such as strings or integers are the representing, storing and working with differing chunks of data.
-
The variable type which can be used in order to solve the problem of storing multiple values is an array.
-
Properties in JavaScript are the characteristics or features of a value.
-
The values which do not have properties are ânullâ and âundefinedâ.
-
We can access properties in a value with a dot and with square brackets.
-
Methods are properties which contain function definitions.
-
Objects are an arbitrary collection of properties.
-
The problems which objects solve that cannot be solved with other value types weâve learned so far is; because objects are able to hold different types of data, programmers are able to store and organise more data in one place.
-
You define an object by creating a list contained within braces. The properties inside the braces are separated by commas. Each property has a name, followed by a colon and a value.
-
Regarding the immutability of JavaScript objects; their properties can be changed (are mutable), meaning a single object value can have different content at different times.
Part Two
-
You canât add new properties to a string variable because JavaScript wonât store them. The values are immutable and cannot be changed.
-
Rest parameters are parameters that allow us to represent an indefinite number of arguments as an array.
-
Serialisation is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed.
-
JSON (or JavaScript Object Notation) is a format of storing and transporting (serialising) data.
-
The differences between JSON and the way programmers write objects in plain JavaScript is that property names are surrounded by double quotes and only simple data expressions are allowed.