-
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?
Theres a strong possibility that the combination of different variables would produce his transformation. Testing one by one would never come up with a positive result. -
What variable type can be used in order to solve the problem of storing multiple values?
An array -
What are properties in Javascript?
Varying characteristics of values, such as length, number, string -
Which values do not have properties?
Null and undefined -
How can we access properties in a value (two ways)?
Value.x fetches the property âxâ of the value ; value[x] evaluates itself the result of which is the property -
What are methods?
A property that contains a function or functions -
What are objects?
An arbitrary set of properties (set up like a list [property, property1, âpropertyâ] which act as a single value -
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 contain all types of data, while those other forms only can work with specific types. -
How do you define an object?
Like how you define a variable except right after the var name are curly brackets ie, let objectDude = {random data type,
randomer data type, 3, âfourâ}; -
What can you say about the mutability of Javascript objects?
Objects allow you to change their properties. -
Why canât you add new properties to a string variable?
Strings arenât designed to be able to accept new properties but they can be processed by methods -
What are rest parameters?
Rest parameters is an argument âŚyourVariableOrFunction which can accept an unlimited array. As a function the native argument if it has ⌠can accept an array when said function is given a call. ⌠also allows an array to be inserted into another array when the inserted array is [âitem1â, âŚinsertedArray, âitem2â]; -
(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 converts memory data into a flat description -
What is JSON?
It is a popular serialization format on the web, and even on other programming languages -
What are the differences between JSON and the way programmers write objects in plain Javascript?
Property names must be surrounded by double quotes, and no function calls, bindings or any other computation, even comments are not allowed.
PART ONE
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?
He needs a lot of data.
The Array object lets you store multiple values in a single variable. It stores a fixed-size sequential
collection of elements of the same type. An array is used to store a collection of data, but it is often
more useful to think of an array as a collection of variables of the same type.
2 What variable type can be used in order to solve the problem of storing multiple values?
Arrays are one variable type capable of storing multiple values.
3 What are properties in Javascript?
Properties are the values associated with a JavaScript object.
4 Which values do not have properties?
Almost all JavaScript values have properties. The exceptions are null and
undefined. If you try to access a property on one of these nonvalues, you get
an error.
null.length;
// â TypeError: null has no properties
5 How can we access properties in a value (two ways)?
You can access properties by a dot or square brackets. ie: data.prop , data[âpropâ]
That is:The dot notation is used if the word after the dot is the literal name of the property that you want to access. The square brackets notation is used if you want an expression to be evaluated first before deriving its property name that you want to access.
6 What are methods?
methods are functions within a class. There are many pre-defined methods in a programming language that can be used for certain data types such as string.length()
slice Extracts a section of an array and returns a new array.
pop Removes the last element from an array and returns that element.
7 What are objects?
Objects is a data structure abstraction usually representing that combines variables in the form of properties and functions in the form of functions to handle and manipulate the object in general.
You define (and create) a JavaScript object with an object literal:
Example
var person = {firstName:âJohnâ, lastName:âDoeâ, age:50, eyeColor:âblueâ};
8 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 hold custom set of values in the form of properties.
The Array object lets you store multiple values in a single variable. It stores a fixed-size sequential
collection of elements of the same type. An array is used to store a collection of data, but it is often
more useful to think of an array as a collection of variables of the same type.
9 How do you define an object?
Use the following syntax to create an Array object â
var fruits = new Array( âappleâ, âorangeâ, âmangoâ );
10 What can you say about the mutability of Javascript objects?
We can change their properties, causing a single object value to have different content at different times.
If the characteristic of a datatype is immutable it means that it cannot be changed. In JavaScript numbers, strings & Booleanâs are immutable, therefore it is impossible to change an existing value of those types. However objects in JavaScript are mutable and the contents of a value can be modified by changing its properties.
PART TWO
1 Why canât you add new properties to a string variable?
.String values are not objects.
A string is not an object but a primitive type, so it is immutable.
2 What are rest parameters?
When we see ââŚâ in the code, it is either rest parameters or the spread operator.
Thereâs an easy way to distinguish between them:
When ⌠is at the end of function parameters, itâs ârest parametersâ and gathers the rest of the list of arguments into an array.
When ⌠occurs in a function call or alike, itâs called a âspread operatorâ and expands an array into a list.
3 N/A
4 What is serialisation and what is a use case of serialisation of data?
In computer science, in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer) or transmitted (for example, across a network connection link) and reconstructed later (possibly in a different computer environment).[1] When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward. Serialization of object-oriented objects does not include any of their associated methods with which they were previously linked. (src WikipediA).
This process of serializing an object is also called marshalling an object.[2] The opposite operation, extracting a data structure from a series of bytes, is deserialization (which is also called unmarshalling).
5 What is JSON?
In computing, JavaScript Object Notation or JSON (/ËdĘeÉŞsÉn/ âJasonâ, /dĘeÉŞËsÉn/)[1] is an open-standard file format that uses human-readable text to transmit data objects consisting of attributeâvalue pairs and array data types (or any other serializable value). It is a very common data format used for asynchronous browserâserver communication, including as a replacement for XML in some AJAX-style systems.[2]
JSON is a language-independent data format. It was derived from JavaScript, but as of 2017 many programming languages include code to generate and parse JSON-format data. The official Internet media type for JSON is application/json. JSON filenames use the extension .json. (src WikipediA).
6 What are the differences between JSON and the way programmers write objects in plain Javascript?
Only simple data expressions are allowed and all property names have to be surrounded by double quotes.
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?
Strings and integers only hold one type of variable, and only one value at a time. The solution to such a problem is having a data structure which can hold multiple values at once. -
What variable type can be used in order to solve the problem of storing multiple values?
Objects and arrays can be used to store multiple values.
3.What are properties in JavaScript?
Properties are certain characteristics that almost all JavaScript possesses (with the exception of null and undefined). For example, .length is a property of how many elements are in an object, or how many letters are in a string.
4.Which values do not have properties?
Values like null and undefined.
5.How can we access properties in a value (two ways)?
One way of accessing properties is by calling the object/array, putting a period â.â and then the property in the object/array. Example: object.length
Another way of accessing properties would be to use square brackets []. This is typically for arrays, accessing the index within the arrays. Example: array[âlengthâ]
6.What are methods?
Methods are properties that contain functions. These functions belong exclusively to the value they belong to.
7.What are objects?
Objects are a data structure that contain multiple values.
8.What problems 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 hold multiple values and data types. For example, boolean values can only be a single value, either true or false. A single object can hold integers, boolean and even arrays in the same object. Another problem that can be solved using objects the mutability. Strings and integers, once set, cannot be changed, and it is not possible for code to change the value. Objects can change their properties, and a single object value to have different content at different times.
9.How do you define an object?
Objects can be defined by curly brackets {}. When inputting object elements, we can follow the name:value pairing.
10.What can you say about the mutability of JavaScript objects?
Strings and integers, once set, cannot be changed, and it is not possible for code to change the value. Objects can change their properties, and a single object value to have different content at different times.
Second Part:
1.Why canât you add new properties to a string variable?
A string variable is immutable.
2.What are rest parameters?
Rest parameter is denoted by a triple period ââŚâ, and if it is used, it âspreadsâ out the array. All elements within the array will be applied as a separate argument.
3.What is serialization and what is a use case of serialization of data?
We serialize data by converting it into a storable format, where we can save data in a file. Rather than sending over oneâs entire computer with the addresses of the values we are interested in, we can flatten the data structures out and send it to the other party.
4.What is JSON?
JSON stands for JavaScript Object Notation. It is a popular serialization format.
5.What are the differences between JSON and the way programmers write objects in plain JavaScript?
Property names have to be surrounded by double quotes (almost like string), and only simple data expressions like boolean, integer, arrays are allowed. No function calls or bindings can be placed within the object/array. A general rule of thumb is that if it involves calculation, it is most likely not allowed. Comments are also not allowed in JSON.
- The problem tackled is the classification of events by date. Variables such as strings and integers are inconvenient and unoptimized to manage large and dynamic datas.
- To manipulate multiple datas, arrays are the best solution. In Javascript, Arrays are handled like objects and therefor inherit proprieties defined by JavaScript itself. Objects can also be used like used as Array with even more functions to them.
- Properties are functions(methods) associated with an Object.
- Only 2 values donât have functions associated to them: Null and Undefined
- The first way to access a property is by looking within the Array using [ and ]. An other way to extract a property is by using the object of that array by using the dot.
- Methods are the other name of functions in an object
- Objects are representations of things (can be anything). They usually have names and methods to interact with them and extract values.
- Objects particularly useful when dealing with large, complex sets of datas. Because coding requires clear structures, objects allows the code to be both complex and expendable while keeping an understandable structure and being easy to update.
- To create an object in JS, simply give a name, a colon and an opening and closing curly braces.
- Objects are mutable. Their methods and values can be changed. Only with the key word âconstâ does methods in objects get locked, however they can still be changed by resting them using the name={ property:value} way.
- Strings are variables that shall not be considered and used like Objects. Meaning itâs not possible to create new properties to a String variable. However, javascript creates objects out of every string variable and append methods to them by default.
- REST parameters allows a function to accept an infinite number of parameters. This way there is no need to create an array of values as parameter, values can be inserted as parameters directly.
- Ok
- Serialization is a use of a standard to send and receive structured datas between computers.
- JSON is one standard over many to serialize datas in order to send and receive them, usually on a network.
- JSON is only intended to transfer datas, not logics. Therefor itâs not a programming language and canât hold any computational code.
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 ?
Variable types such as strings and integers are only able to hold a single type of data but we needs a data structure that is capable of storing multiple values and datatypes to keep all of the information.
2 What variable type can be used in order to solve the problem of storing multiple values ?
Array and Objects can be used in order to solve the problem of storing multiple values.
3 What are properties in Javascript ?
A property is an association between a name (or key) and a value.
4 Which values do not have properties ?
Almost all JavaScript values have properties. The exceptions are null and undefined.
5 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. Both value.x and value[x] access a property on value.
Properties that contain functions are generally called methods of the value they belong to.
let doh = âDohâ;
console.log(typeof doh.toUpperCase);
// function
console.log(doh.toUpperCase());
// DOH
âtoUpperCase is a method of a stringâ
6 What are methods ?
Objects are composed of attributes. If an attribute contains a function, it is considered to be a method of the object, otherwise the attribute is considered a property.
7 What are objects ?
A set of entries can be represented as an array but the entries do not consist of just a number or a string , each entry needs to store a list of activities and a Boolean value that indicates whether something is true or false. Ideally, we would like to group these together into a single value and then put those grouped values into an array of entries.
8 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) ?9 How do you define an object ?
Object values can be modified. The types of values discussed such as 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. The text inside it cannot be changed. If you have a string that contains âcatâ, it is not possible for other code to change a character in your string to make it spell âratâ.
9 How do you define an object ?
Objects are used to store collections of various data and more complex entities.
10 What can you say about the mutability of Javascript objects ?
With objects, there is a difference between having two references to the same object and having two different objects that contain the same properties.
When you compare objects with JavaScriptâs == operator, it compares by identity: it will produce true only if both objects are precisely the same value. Comparing different objects will return false, even if they have identical properties.
SECOND PART :
1 Why canât you add new properties to a string variable ?
Values of type string, number, and Boolean are not objects, and though the language doesnât complain if you try to set new properties on them, it doesnât actually store those properties. Such values are immutable and cannot be changed.
2 What are rest parameters ?
The rest parameter syntax allows us to represent an indefinite number of arguments as an array.
3 What is serialisation and what is a use case of serialisation of data ?
The process whereby an object or data structure is translated into a format suitable for transferral over a network, or storage. Through serialization, a developer can perform actions like sending the object to a remote application by means of a Web Service.
4 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.
5 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.
FIRST PART:
1- The chapter introduces a problem where we need a variable that contains multiple variables in and of themselves. For instance when logging the activities of a day, we need a series of strings containing activities (stored as an array) and also a Boolean type variable to know whether or not we turned into a squirrel. Strings or integers, in contrast, store a single value.
2- It depends, generally speaking we use âobjectsâ which contain multiple values of different type (Booleans, integers, strings, etc). On many occasions weâll use arrays, which will contain a varying number of conceptually identical values: An array of numbers, an array of strings, etc.
3- Values in Javascript have properties. Properties are characteristics of the value or object, such as the length of a string, or the index of a value in an array.
4- Null and undefined have no properties in Javascript.
5- Thereâs two ways to access properties: value.prop or value[âpropâ]
6- A method is a function that lives within a property. Math.max is a method whereby we take an array of numbers and return the highest number in the array.
7- An object is a way of storing multiple values in a single value. Itâs like putting several things into a âbagâ and then calling that bag instead of each separate object. Arrays are a subset of objects, the difference is in an object we have more or less a fixed number of values, and each value is named, in an array, the values are of the same âtypeâ (all numbers, all strings, etc) and the name of each value is serialized with an index number starting at 0.
8- When we want to create a value that has multiple âcharacteristicsâ we create an object and store these characteristics therein. As an example, a car will have a color, an age, a brand, etc. These are different characteristics that all belong to the same âobjectâ that is a car. So we create an object, define values within such as âcolorâ, âageâ, âbrandâ and assign specific values to it. Then, if I can call the characteristics of this car by writing âcar.colorâ for itâs color, or âcar.brandâ for the brand. Very useful for creating complex values with multiple dimensions.
9- An object is defined by using brackets: let car = {brand: âBMWâ, color: âredâ, broken: false};
10- Mutability of an object means the values of the object can be changed. For instance, our car can be broken and therefore we do car.broken = true, this will update the property of the car object.
SECOND PART:
1- A string variable IS NOT an object, therefore, itâs not possible to add properties. A string is a âpredefinedâ object, if you will.
2- âRestâ parameters are a way of calling all the values in an array, or those that havenât been called explicitly, thus the name ârestâ: it calls âthe restâ of the arguments.
3- Serialization of data is to convert data stored in memory into a flat description of what the data is. Itâs useful when we need to send that data over the web into a different physical location (another computer or server).
4- JSON stands for JavaScript Object Notation. Itâs a popular serialization format.
5- JSON is similar to JavaScript in the way it stores object with the difference that all property names have to be stored in double quotes and only simple data expressions are allowed. No function calls, bindings, or anything involving real computation.
EDIT: I started watching the video after this reading part I swear the car example was something I came up with on my own
-
The problems introduced that cannot be solved with variable types (strings, integers) is that the creature needs to store data in a structure that can handle the storage of multiple values and data types in one space.
-
Arrays, for example, can be used in order to store multiple values
-
Properties are the values associated with a JavaScript object.
-
Null and undefined, for example. I would assume NaN as well.
-
Dot notation and bracket notation are the two ways
-
Methods are actions that can be performed on objects
-
An object is a collection of properties, and a property is an association between a name (or key) and a value.
-
Objects bring together multiple properties and methods into one single entity.
-
In real life, a car is an object.
A car has properties like weight and color, and methods like start and stop:
- Javascript objects are mutable
-
Because a string variable is not an Object,
-
The rest parameter syntax allows us to represent an indefinite number of arguments as an array.
-
That was trying
-
Serialization allows the developer to save the state of an object and recreate it as needed, providing storage of objects as well as data exchange. ⌠a method of persisting objects, for example writing their properties to a file on disk, or saving them to a database
-
JavaScript Object Notation-- a minimal and readable format to structure data
//
It is language agnostic data-interchange format.
- Data can be stored in many ways, but if it should be stored in a text file and be readable by a computer, it needs to follow some structure. JSON is one of the many formats that define such a structure.
In contrast, JavaScript is a programming language. Of course JavaScript also provides a way to define/describe data, but the syntax is very specific to JavaScript.
- Variables such as string or integers can store only single type of data.
- Arrays
- Almost all JS values have properties
- Null, Undefinited
- value.x value[ x]
- Methods are properties with functions.
- Object can store different groups of properties
- Object allow to store different data types
- Object should be inside braces, properties inside the braces are separated by commas each property have name : value
- Objects can be mutable
SECOND PART:
1 Because strings variables are immutable
2. Rest parameter allowed us to give function unlimited access to arguments
3. ok
4. Serialisation is converting data and flattening it to be able to send it from one system to another.
5 JSON (JavaScript Object Notation) is popular format of serialisation of data
6 In JSON 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 also 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?
A variable type is needed that can store multiple values -
What variable type can be used in order to solve the problem of storing multiple values?
Arrays -
What are properties in Javascript?
Properties are the values associated with a JavaScript object -
Which values do not have properties?
Null and undefined are the exceptions that do not have properties -
How can we access properties in a value (two ways)?
value.x or value[x] -
What are methods?
Methods are properties that contain functions -
What are objects?
Values of 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)?
Objects are special as they are able to hold as many different datatypes as we need -
How do you define an object?
objects in js are defined by {}
properties and values populate the object
let object = {property: âvalueâ} -
What can you say about the mutability of Javascript objects?
values of properties in an object can be changed as needed
SECOND PART:
-
Why canât you add new properties to a string variable?
They are immutable and canât be changed -
What are rest parameters?
A function to accept any number of arguments -
What is serialisation and what is a use case of serialisation of data?
Serialisation is converting data stored in memory into a flat description of what that data is. It is useful for when we want to do things like saving the data to a file or transferring it to another computer on a network -
What is JSON?
JavaScript Object Notation is a serialisation format widely used for data storage -
What are the differences between JSON and the way programmers write objects in plain Javascript?
All property names need to be surrounded in double quotes and only simple data expressions are allowed. So no function calls, bindings, or anything that involves actual computation. Also, 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?
He want so have a set of data that he could track, and this is not possible by using single variables. - What variable type can be used in order to solve the problem of storing multiple values?
A array(table) could be used to store multiple values which is what he need. - What are properties in Javascript?
Properties in Javascript are information about the value. It could be the length or the max of an array as an example. - Which values do not have properties?
null and undefined are the only values that does not have any properties. - How can we access properties in a value (two ways)?
By using the dot, like array.lenght or you can use brackets like array[âlengthâ]. - What are methods?
Methods are a property that is a function. Like toUpperCase is a property function for strings, and its therefor called a method for strings. - 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)?
They grasp multiple values of different types, it could also be other objects. Just think about a person, a person has a name, which is a string, but also an age(number), height, weight, etc. Could also have parents of the same object. By defining a object you can collect all information thatâs necessary in one value. - How do you define an object?
By brackets like this:
testObject{
name: âfirst lastâ,
age: 25,
planet: âTellusâ,
results: [5, 10, 4, 1, 32]
} - What can you say about the mutability of Javascript objects?
As for the normal values that we have learn up to now, we canât change the content with other code, immutable. This is not possible with objects. That would say that if you have an object object1 and an object object2 that share the same identical property a change of this property in one of them would also effect and change the other to the same.
Part 2
- Why canât you add new properties to a string variable?
Strings, numbers and Booleans are not objects and therefor you canât add new properties for them, even though the language does not complain, but they doesnât store these properties so they arenât there. - What are rest parameters?
Rest parameters is a syntax that allows as to include an indefinite number of arguments to a function. This is done by adding ⌠before the last parameter in the function. - (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 to convert data/memory into a flat description. - What is JSON?
JSON is a common used format for serialization which stands for JavaScript Object Notation. It is widely used as a data storage and communication format on the web. - 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.
-
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 problem of working with different types of data, or more complex data, e.g. sequences of values. -
What variable type can be used in order to solve the problem of storing multiple values?
Objects and arrays -
What are properties in Javascript?
Almost all JavaScript values have properties, for example length or color. Expressions like Math.max are used to access a property of some value. -
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?
Methods are functions that live in properties and usually act on the value the are a property of.
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?
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)?
Objects give the ability to group arbitrary collection of properties of different types together into a single value. Objects allow us to group values, including objects, to build more complex structures. -
How do you define an object?
using braces as an expression, list the properties seperated by commas -
What can you say about the mutability of Javascript objects?
object values can be modified but numbers, strings, and Booleans, are all immutable.
Objects work differently. You can change their properties, causing a single
object value to have different content at different times.
STRINGS and their properties
- Why canât you add new properties to a string variable?
because they are not objects they are immutable - What are rest parameters?
The rest parameter syntax allows us to represent an indefinite number of arguments as an array.
(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 in order to save or share it over a network efficiently.
- What is JSON? a popular serialization format
- What are the differences between JSON and the way programmers write objects in plain Javascript? In JSON 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 either in JSON.
What problems does this chapter introduce that cannot be solved with variable types such as strings or integers? : Connected, indexed values
What variable type can be used in order to solve the problem of storing multiple values? : Array
What are properties in Javascript? : In built values which can be accessed
Which values do not have properties? : Booleans, Strings
How can we access properties in a value (two ways)? . and []
What are methods? Properties that contain functions
What are objects? : Objects are arbitrary collections of properties, created 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)? : They can create nested relations between user defined data objects
How do you define an object? : created by using braces as an expression.
What can you say about the mutability of Javascript objects? : You can change an objects value, causing a single object value to have different content at different times
Think about the following questions:
Why canât you add new properties to a string variable? : Values of type string, number, and Boolean are not objects, and though the language doesnât complain if you try to set new properties on them, it doesnât actually store those properties.
What are rest parameters? : allows us to represent an indefinite number of arguments as an array
What is serialisation and what is a use case of serialisation of data? : serializing data is finding some sort of universal format that can be easily shared across different applications
What is JSON? : Most common serialisation format
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.
OK hot and bothered need to get some sunshine
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? He needs to create a data structure that allows for the storage of multiple types of data and values.
What variable type can be used in order to solve the problem of storing multiple values? Arrays
What are properties in Javascript? Properties associated with and object in JavaScript.
Which values do not have properties? NULL and Undefined.
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?
Properties that contain functions.
What are objects?
Store different groups 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)?**Objects can hold multiple values and data types and can be changed unlike other immutable properties.
How do you define an object?
Using curly braces.
What can you say about the mutability of Javascript objects? They are mutable and are flexible. This expands on what you can do in JavaScript.
Part 2
Why canât you add new properties to a string variable?
value of strings are immutable and cannot be changed unlike objects which can be changed.
What are rest parameters?
These are denoted by a functionâs last parameter with 3 dots before its name and are useful for functions that accept any number of arguments. When the function is called, the rest parameter is bound to an array containing all further arguments.
What is serialisation and what is a use case of serialisation of data?
Object serialization is the process of converting an objectâs state to a string from which it can later be restored.
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?
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.
-
It introduces us to arrays and using data structure.
-
Arrays
-
Properties are expressions to reach a property of a value.
-
Null and Undefined.
-
With â.â and â[]â
-
Methods are functions that can be used with different functions or strings or arrays with a method
-
Objects are an arbitrary collection of properties.
-
We can store multiple results as strings, boolean, integer and work around with them in the same object.
-
let anObject = {propertyOne: 1, propertyTwo: 2};
-
Objects being mutable gives us an opportunity to manipulate the properties of objects as we want and it gives us flexibility.
-
Because strings integers and booleans are immutable
-
Rest parameters accept any number of arguments in an array, variable
-
I did
-
Serialization is to convert data/memory into a flat description.
-
JSON is a commonly used format for serialization which stands for JavaScript Object Notation. It is widely used as a data storage and communication format on the web.
-
SON 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.
-
Data sets.
-
Objects.
-
Properties are the property of a value, such as .length.
-
null and undefined.
-
value.x or value[x]
-
Properties that contain functions of the value they belong to.
-
Arbitrary collections of properties.
-
Data sets.
-
Using braces as an expression, e.g object = {property: value}
-
You can change the properties of objects.
-
String variables are immutable.
-
Parameters that allow a function to accept any number of arguments.
-
Converting data to a flat description.
-
JavaScript Object Notation, a popular serialization format.
-
All property names have to be surrounded by double quotes, and only simple data expressions are allowed.
-
The problem of being able to properly store and log multiple pieces of information
-
Arrays
-
Properties describe characteristics of a value in a data structure
-
Null and undefined.
-
with either a dot and the name of the property (value.length) or with square brackets with an expression that evaluates the property (value[x])
-
Methods are basically functions. They only work on value they belong to.
-
Objects are a collection of properties. A user can store various value types within them
-
They can store far more information and also different types of values.
-
Start by defining a binding, then inside curly brackets you add your properties and their values. A semi-colon will separate the property from its value. Here is an example: let laptop = {type: âmacâ, color: âsilverâ}
-
Object properties are able to change when provided with new information.
-
Because they are immutable
-
Rest parameters allow a function to accept multiple arguments
-
serialisation converts memory addresses to a flat description. This allows it to be stored or sent.
-
JSON (java Script Object Notation) serialises data. So basically it is a data storage and communication format.
-
All property names are surrounded by double quotes, and only simple data expressions are allowed.
1 We have to store sequences of values (or just some values), but strings or single (int) variables canât do that, which is why an array helps us store many values in a single variable.
2 An array.
3 They display values attributes, like for instance:
var myString = âwordsâ
myString.length
//this will disply the length of the string, which would be equal to 5. It is the property of the value in myString variable.
4 null and undefined.
5 With a dot and with square brackets (they may access different properties)
value.x
//this access the overall properties, of the whole array
value[x]
//access the property of a specific value in an array, like in this example, with the binding x
6 Functions that live in properties and act on the value they are a property of. Simply: functions of properties, of the values in them.
7 Collections of properties. Objects help group several values into a single value.
8 It helps store different variables into a group, like an array and Boolen can be put into an object.
9 By using braces and seperating properties with commas.
let anObject = {isTrue: true; toDo: [âsleepâ, âeatâ, âworkâ]}
For storries ojbect in an array
let anObject = [{toDo: [âsleep, eatâ], isDoing: true} , {toDo:[ânothingâ], isDoing:false}];
10 strings, numbers, Booleans are immutable, their values canât be changed. Object properties can be changed, meaning they are mutable.
Questions after sub-chapter "Strings and their properties"
1 Strings are immutable. Values can not be changed.
2 Rest parameter
3 Skipped
4 Simplifying code to a flat description (a condensed description). It makes it easier to send data to other computers (or things).
5 A serialization format, which stands for JavaScript Object Notation. A widely used data storage and communication format on the Web.
6 It is similar to JavaScript, but 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.
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?
Jacques needs to create a data structure to keep tabs of several values of different types of data. With strings and integers, we would have multiple points of data that is not possible; meaning that there will be too many variables and unorganized.
What variable type can be used in order to solve the problem of storing multiple values?
An array which can hold more than one value at a time. A good example is with cars:
var car1=âSaabâ
var car2=âDodgeâ
var car3=âToyotaâ
var car4=âLadaâ
What are properties in Javascript?
With properties in Javascript, they are related to objects which can usually be changed, added, and deleted. But, there are some that are read only.
Which values do not have properties?
Null and Undefined
How can we access properties in a value (two ways)?
Value.prop or value[prop]
What are methods?
Methods are functions that live in properties and usually act on the value they are a property of.
What are objects?
Objects are containers for the named values, âpropertiesâ that store more or less a fixed set of them.
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)?
With objects, it has an identity and is changeable. Primitive values have not identity or prototype.
How do you define an object?
You can define and create by using curly brackets inside a list of properties that are separated with commas. Each name has a colon and value, for example:
var person = {firstName: âJohnâ, lastName:âSmithâ, age: â25â, eyeColor:âbrownâ};
What can you say about the mutability of Javascript objects?
With object values they can be modified (mutable); whereas numbers, strings, and Booleans cannot be modified.
SECOND PART
Why canât you add new properties to a string variable?
A string is not an object but a primitive which are immutable.
What are rest parameters?
Rest parameters allows us to represent an indefinite number of arguments as an array and are represented as an ellipsis with in two parenthesis (âŚ).
(Feel free to skip the sub-chapter of Math object and Destructing)
Ok Will do for now.
What is serialization and what is a use case of serialization of data?
Serialization is the process of converting data that is stored by addresses into the computerâs memory to a flat structure. A case use of serialization is sending data over a network.
What is JSON?
JSON (Java Script Object Notiation) is a minimal, readable format for structuring data that is use to transmit stored data between a server and a web app.
What are the differences between JSON and the way programmers write objects in plain Javascript?
JSON Property names must be in between double quotes and only simple data (no functions, bindings or comments) can be passed as values.
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?
The chapter introduced the concept of objects, arrays, properties and methods. The problems that can only be solved by objects are those that involve creating and manipulating complex data structures that donât rely on a single value, as regular variables do, which handle only numbers, strings an boolean expressions.
2. What variable type can be used in order to solve the problem of storing multiple values?
Object-type variables, which can store arrays (sets of values) and even functions and other objects.
3. What are properties in Javascript?
Properties are expressions that access a specific characteristic of a value.
4. Which values do not have properties?
Null and undefined have no properties,
5. How can we access properties in a value (two ways)?
By using, after a value, a dot (value.x), or square brackets ( value [ ] ).
6. What are methods?
Methods are properties that contain functions.
7. What are objects?
Objects are groups of values that contain arbitrary collections of properties.
8. 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)?
By grouping together different types of values, we can call, manage, manipulate and return complex data structures by accessing pre-existing properties or custom properties and methods.
9. How do you define an object?
An object is a space that contain or encapsulate values and code (data and functionality), which can be used and manipulated in may different ways.
10. What can you say about the mutability of Javascript objects?
Simple values, such as integers, strings and booleans are immutable â they canât be changed. The values can be combined, and new values can be derived from them, but the original values always remain themselves.
With objects, the content of a value can be modified by changing its properties.
SECOND PART:
1. Why canât you add new properties to a string variable?
String values have some built-in properties, such as length and toLowerCase, and you can even set new properties onto string variables. But these properties wonât be stored.
2. What are rest parameters?
Parameters
are variables listed as part of the function definition.
Arguments
is an object; a type of parameter comprising the values that are passed to the function when invoked.
Rest parameters
are real arrays which contain only the arguments that have no corresponding parameter. They are the last parameter in a function, written after three dots. They are useful when we need a function to accept any number of arguments. Example: function myParameter(...myArguments) { }
3. (Feel free to skip the sub-chapter of Math object and Destructing)
Roger that.
4. What is serialization and what is a use case of serialization of data?
Serialization is a process that converts objects and arrays of data (which are stored in computer memory as sequences of bits holding addresses of their content) into a flat description. This âflatteningâ process makes it much more efficient to store and transfer information from one computer to another, especially considering how in JavaScript arrays are contained within arrays, within arrays, and each level with itâs own storage address reference.
5. What is JSON?
JSON (pronounced: Jason) stands for JavaScript Object Notation and it is a serialization format widely used in JavaScript and on the Web, even in other computer languages.
6. What are the differences between JSON and the way programmers write objects in plain Javascript?
JSON and JavaScript look very similar, with a few differences. In JSONâŚ
- All property names have to be surrounded in double quotes,
- Only simple data expressions are allowed (nothing that involves actual computation)
- No comments are allowed.