Data Structures (Arrays and Objects) - Reading Assignment

  1. Strings and integers are immutable, so therefore they can not be changed or manipulated.

  2. Array and Object.

  3. property is a characteristic of an object, often describing attributes associated with a data structure.

  4. null and undefined.

  5. By using the value.x or value[x] a dot or square bracket.

  6. Method are property that contain function.

  7. They are stand-alone entities that hold multiple values in terms of properties and methods.

  8. They allow programmers to group several value, properties in a single object.

  9. Object is the collection of properties, and its created with curly braces.

  10. Because object value can be changed or modified.

Part 2.

1.They are not objects and JS doesn’t store new properties, because such value are immutable and can not be changed.

  1. It is help a function to accept any number of arguments.

  2. thanks.

  3. Converts data to a flat description, removing unneeded space, line-breaks and comments, more efficient with sending data.

  4. JSON is widely used as a data storage and communication format on the Web, even in languages other. it is popular in serialisation of data in the web.

  5. Property names in JSON are surrounded with double quotes and no comments are allowed, and no function calls, bindings or anything that needs actual computation.

1 Like

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?

To work with a chunk of digital data, we’ll first have to find a way to represent
it in our machine’s memory. In order to do that, we can’t use strings and integers. We have to list the different data in a single object.

2- What variable type can be used in order to solve the problem of storing multiple values?

Array and Objects

3- What are properties in Javascript?

Properties are the values associated with a JavaScript object.

4-Which values do not have properties?

The exceptions are null and undefined.

5- How can we access properties in a value (two ways)?

we can use value.x to get the property named x. Or we can use value[x] where the x is evaluated to get the property name.

6- What are methods?

Properties that contain functions are generally called methods of the value they belong to.

7- What are objects?

Values of the type object are arbitrary collections of properties. All JavaScript values, except primitives, are objects.

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)?

As almost everything is an object, objects can contain different data types, so that we can create more complex data structures.

9- How do you define an object?

Objects are defined surrounded by { }. Object values are written as name : value pairs (name and value separated by a colon).

let person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

10- What can you say about the mutability of Javascript objects?

The types of values such as numbers, strings, and Booleans, are all immutable. It
is impossible to change values of those types. Objects work differently. You can change their properties, causing 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?

When you take a specific string value, that value will always remain the same.

2- What are rest parameters?

Rest parameters are the parameters that bound to an array
containing all further arguments.

(...number)

4- What is serialisation and what is a use case of serialisation of data?

Converting the tangles of memory addresses to a description that can be stored or sent. It is widely used as a data storage and communication format.

5- What is JSON?

JSON (JavaScript Object Notation) is a popular serialization format.

6- 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.

1 Like

Part 1:

  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 problem is the need for a data structure that allows for multiple value types to be included inside of one expression.

  1. What variable type can be used in order to solve the problem of storing multiple values?

An Array

  1. What are properties in Javascript?

Properties are descriptions of a value or actions that affect a value.

  1. Which values do not have properties?

Null and Undefined

  1. How can we access properties in a value (two ways)?

value.x or value[x]

  1. What are methods?

Methods are properties that contain functions.

  1. What are objects?

An object is a value that contains an arbitrary collection of properties.

  1. 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 allow us to contain multiple value types and then place the object into an array of objects.

  1. How do you define an object?

Assign a variable with a value followed by an equal sign and curly brackets. Inside the curly brackets, list each property name followed by a colon and the values. Separate property statements by a comma.

  1. What can you say about the mutability of Javascript objects?

Yes, objects are mutable in that you can change the values associated with the object’s properties.

Part Two:

  1. Why can’t you add new properties to a string variable?

JavaScript doesn’t allow it.

  1. What are rest parameters?

three dots (…) placed before a function’s parameter that allows any number of array values to be used.

  1. (Feel free to skip the sub-chapter of Math object and Destructing)

  2. What is serialisation and what is a use case of serialisation of data?

The values in objects and arrays are stored in memory addresses separate from the objects and arrays and are only linked to the object and array memory addresses. When we want to save the data or send it to another computer, the memory addresses have to be converted to a stream of bytes that can be stored or sent. That process of conversion is called serialization.

  1. What is JSON?

JSON is an abbreviation for JavaScript Object Notation and is a popular serialization format.

  1. What are the differences between JSON and the way programmers write objects in plain Javascript?

All property names in JSON must be surrounded by double quotations and objects cannot contain function call, bindings, or anything that involves computation.

1 Like
  1. Information that requires more than one atom.

  2. Object

  3. Properties are the way to access value in expressions.

  4. null and undefined.

  5. . or []

  6. Methods are properties that contain functions

  7. Object are a collection of properties within[]

  8. Objects allow us to create a stack binding booleans and expressions together.

  9. let={}

  10. strings, numbers and booleans in an object can not be changed.

  11. A string is an immutable value

  12. rest parameters are used to bind and/or separate arguments inside an array.

  13. Serialisation is how data memory is compressed into a flat description, used to store or save a file.

  14. Json is the most popular serialisation format Java Script Object Notation

  15. JSON must have ""double quotes with only simple data expressions, programmers write the same in plain java script except computation can be called;

1 Like
  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?
    A journal is started to track different events that have occurred in a period of 30 days, creating lots of information that needs to be traversed and considered to draw a relation based on the events that took place in each day.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    An “Object” or an “Array” can be used to store multiple values.

  3. What are properties in Javascript?
    Properties are a type of feature or function that belongs to a certain value.

  4. Which values do not have properties?
    Almost all values have properties with the exceptions being “null” and “undefined”.

  5. How can we access properties in a value (two ways)?
    Properties of a value can be accessed with two ways = value.x or by value[x]

  6. What are methods?
    Methods are functions stored as object properties.

  7. What are objects?
    Objects are an unordered list of related data.

  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 allow the data to be grouped and also to give it relation.

  9. How do you define an object?
    An unordered list of related values.

  10. What can you say about the mutability of Javascript objects?
    Objects are like cars and although it is possible to have two cars that are the same make, year and color they are not the same car and the color can be changed at anytime in either of the two cars. Unless a two bindings are talking about the same car we cannot say that the two cars(objects) are the same because they have similar properties.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    A strings like numbers are immutable.

  2. What are rest parameters?
    Rest parameters are a type of syntax that allow a function to accept an indefinite number of arguments as an array.

  3. (Feel free to skip the sub-chapter of Math object and Destructing)

  4. What is serialisation and what is a use case of serialisation of data?
    It is to translate an object or a data structure to a format that can be stored or transferred. This is done in order to save memory.

  5. What is JSON?
    JSON is a way to store and transfer data in human-readable text

  6. 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, but it also has some restrictions. All property names must be surrounded by double quotes, and only simple data expressions are allowed (no function calls, bindings, or anything that involves actual computation)

1 Like
  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

You need a variable that can store multiple values, something integers, and strings cannot do.

  1. What variable type can be used in order to solve the problem of storing multiple values?

Arrays and objects.

  1. What are properties in Javascript?

These are specific attributes to a Javascript, value and they can then be called and utilised.

  1. Which values do not have properties?

Null and undefined.
pe.
5. How can we access properties in a value (two ways)?
[] and .
6. What are methods?

these are properties that contain function od a specific type.

  1. What are objects?

Its a collection of properties. like library of details inside a variable.

  1. 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)?

You can store multiple values similar to an array, but with object eac value can have name and not jsut a index number. like left : 1, right :2. now both the keys AND the values are being stored.

  1. How do you define an object?

with object = { x : 1, y, =2 }

  1. What can you say about the mutability of Javascript objects?

They can be changed whereas integers, string and Boolean cannot.

SECOND PART:

  1. Why can’t you add new properties to a string variable?

They are not objects and are thus immutable.

  1. What are rest parameters?

These are all the given arguments in an array.

  1. (Feel free to skip the sub-chapter of Math object and Destructing)

  2. What is serialisation and what is a use case of serialisation of data?

Itt is a way of storing the address of data in a more space efficient way. In a flat data set.

  1. What is JSON?

JavaScript Object Notation.It is used as a data storage and communication format on the Web.

  1. 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.

1 Like
  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?
    Ans - Data structures like strings and numbers can only store single data. But on this occasion, they need to store multiple data types and values to keep information organized.
  2. What variable type can be used to solve the problem of storing multiple values?
    Ans - Arrays
  3. What are properties in Javascript?
    Ans - Properties define some characteristics of the values in a data structure.
  4. Which values do not have properties?
    Ans - Null and undefined
  5. How can we access properties in a value (two ways)?
    Ans - We can use the dot and square brackets.
  6. What are methods?
    Ans - Methods hold function values. These are special kinds of functions.
  7. What are objects?
    Ans - Objects are 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)?.
    Ans - Objects can hold different data types.
  9. How do you define an object?
    Ans - Objects are defined as the same as other variables.
  10. What can you say about the mutability of Javascript objects?
    Ans - Object values can be changed so those are mutable and data types like String and numbers are immutable.

Part II

  1. Why can’t you add new properties to a string variable?
    Ans - You can combine and derive new values from string variables but you can’t change the characters inside a string to be a new one.
  2. What are rest parameters?
    Ans - rest parameters are used to accept any number of arguments.
  3. What is JSON?
    Ans - JSON is a serialization format that is used for data storage and communication.
  4. What are the differences between JSON and the way programmers write objects in plain Javascript?
    Ans - In JSON all property names should be surrounded by double quotes, and only simple data expressions are allowed. JSON can’t do any function calls, binding, or and computational data.
1 Like
  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?
    Different data in a variable.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    Array

  3. What are properties in JavaScript?
    Objects are contained for named values, called properties and methods. property can be primitive values, other objects or functions.

  4. Which values do not have properties?
    Null and undefined.

  5. How can we access properties in a value (two ways)?
    array.length or array(“length”)

  6. What are methods?
    Method can be used for manipulating arrays.

  7. What are objects?
    Objects are values of 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)?
    Object can be modified, can store different type of value.

  9. How do you define an object?
    objectName = {key:value, key:value}

  10. What can you say about the mutability of Javascript objects?
    Object values can be modified

  11. Why can’t you add new properties to a string variable?
    Strings are immutable.

  12. What are rest parameters? (…) allow a function to accept any number of arguments.

  13. What is serialisation and what is a use case of serialisation of data?
    Serialisation is conversion code to flat description, useful for transferring it.

  14. What is JSon?
    Popular serialization format, JavaScript Object Notation.
    6.What are the differences between JSON and the way programmers write objects in plain Javascript?
    Property names have to be surrounded by double quotes, and only simple data expressions are allowed, no function calls and no comments.

1 Like
  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 storage multiple data types. Strings and integers can only store single data types

  1. What variable type can be used in order to solve the problem of storing multiple values?

Array

  1. What are properties in Javascript?

A property is a characteristic of an object, often describing attributes associated with a data structure.

  1. Which values do not have properties?

Null and undefined values.

  1. How can we access properties in a value (two ways)?

objectName.property

objectName[“property”]

  1. What are methods?

Properties that contain functions are called methods of the value they belong to

  1. What are objects?

Objects are a collection of properties

  1. 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)?

Permits flexibility of having multiple properties within the object.

  1. How do you define an object?

Objects are containers for named values called properties and methods

  1. What can you say about the mutability of Javascript objects?

Numbers, strings, Booleans are immutable. Objects are mutable. You can change an object’s properties which causes the value to have different content at different times.

  1. Why can’t you add new properties to a string variable?

Strings are immutable therefore cannot be changed or edited.

  1. What are rest parameters?

Allows us to represent an indefinite number of arguments as an array

  1. What is serialisation and what is a use case of serialisation of data?

Serialisation is the converting of data into a flat description. It can be used as a data storage and communication format on the web.

  1. What is JSON?

Json is a popular serialisation format. It stands for Javascript Object Notation.

  1. What are the differences between JSON and the way programmers write objects in plain Javascript?

With Json, all property names have to be surrounds by double quotes, and only simple data expressions are allowed ie. No function calls, bindings or anything involving actual computations.

1 Like

– Part 1 –

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?
Tracking changes in sets of values is not possible with regular single integer or string variables.

2. What variable type can be used in order to solve the problem of storing multiple values?
Arrays are a data structure that allows for the storage of multiple values.

3. What are properties in Javascript?
Properties are characteristics of some value or object, describing an attribute associated with a specific data structure.

4. Which values do not have properties?
Null and undefined do not have properties as they are nonvalues, attempting to access properties of them will return an error.

5. How can we access properties in a value (two ways)?
Properties of values can be accessed by using . or [];

let sequence = [1,2,3,4,5];
	console.log(sequence.length);
	console.log(sequence["length"]);
	// 5
	// 5

6. What are methods?
Methods are functions stored as object properties.

let list = [1, 2, 3];
//object list, an array has multiple integer values(properties).
list.push(4);
console.log(list);
//will access the values within the object and add 4 onto the end of the array and print to console.
// [1, 2, 3, 4]
list.pop();
console.log(list);
//similarly; list.pop(); will remove the last item from the list.
//[1, 2, 3]

7. What are objects?
Objects allow for the storage of not only lists of values, like arrays, but for each item within the object to have its own subset of values, properties, and methods. Thus far greater complex data structures are created.

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)?
Objects allow for greater variation in data storage and structuring, as well as their mutability enabling us to equate two object identity, not just their values as data is referenced through the object rather than the values of said objects

9. How do you define an object?
Objects can be defined with the = operator and by being contained within braces.

let aHuman = {Name: "Jack", Age:29};
		console.log(aHuman);

10. What can you say about the mutability of Javascript objects?
Unlike booleans, strings, and integers, objects are mutable.

– Part 2 –

1. Why can’t you add new properties to a string variable?
As they are immutable, they cannot be altered.

2. What are rest parameters?
Rest parameters allow for any number of arguments to be passed to a function as an array, allowing for easier handling of various parameters in a function.

3. What is serialization and what is a use case of serialization of data?
To reduce the clutter or code, so it is more easily transferrable, readable, and takes less memory. (Flattening) think of the difference between the two versions of jQuery.

4. What is JSON?
JavaScript Object Notation is used for data storage, sending, and receiving data over the network, as well as for Web applications.

5. What are the differences between JSON and the way programmers write objects in plain Javascript?
JSON is a text-only format to communicate between server and client, unlike Javascript which contains computation.

1 Like

Everything up to computing correlation was understandable… Now i’m re reading computing correlation for the 12th time… still don’tt get it… -_-"

any one have any other good resources that can help understanding how To extract a two-by-two table for a specific event from the journal… or how the functions used work at least? :confused:

Didn’t realize we were not meant to go through that sub-chapter!.. took me a while to figure that out :sweat_smile:

Data Structures (Arrays and Objects) answers -

  1. Strings and integers can only store single values of data. However to solve the were squirrel problem we need to store multiple data sets within objects. (?)

  2. Arrays and objects are a useful way to solve multiple values within a binding.

  3. The property is a characteristic attached to the value of an object

  4. Null & Undefined

  5. value.x or value[x] -
    The former is different in that the x given is a variable pointing directly to an array’s property. whereas value[x] grabs the property directly from the array.

  6. Properties that hold functions of the value.

  7. They are a collection of properties, objects have multiple properties within them

  8. Objects can store multiple values/data types such as integers, strings, arrays, booleans, etc.

  9. To create/define an object, braces are used, Properties within braces should be separated with commas, and each property is named followed by a colon (“:”) and a value of the property.

  10. Objects, unlike strings and booleans, ARE mutable. Objects can be changed and modified at a certain time when needed. ( by using the “=“ operator.)

Part 2.

  1. Why can’t you add new properties to a string variable?

strings aren’t objects and therefore are immutable.

  1. What are rest parameters?

Rest Parameters ( …numbers) are functions that accept any number of arguments. When such an argument is called the rest parameter is bound to the array containing further arguments.

  1. What is serialisation and what is a use case of serialisation of data?

Serialisation is the action of converting data into a flat description which is usually done for the storage and transfer of specific data.

  1. What is JSON?

One popular serialisation format is JSON (JavaScript Object Notation). It is used to store data and a communication format on the web (It’s very widely used, and often not only for javascript)

  1. What are the differences between JSON and the way programmers write objects in plain Javascript?

Functions and various other expressions, such as calls, comments, and bindings are not allowed in JSON and all property names have to be wrapped in quotes (“ “).

1 Like

FIRST PART

  1. It introduces the problem of how to store groups of information.
  2. Arrays and Objects
  3. Properties are peculiar attributes of values.
  4. Null & Undefined.
  5. i… Dot ; value.x
    ii… Square Bracket; value[x]
  6. Methods are functions that live inside the properties of a value. That is, when some properties are called it performs an action.
    7.Objects are special kind of arrays that collects data into groups. They are arbitrary collection of properties.
  7. They basically can solve the problem of mutability, that is they can be modified.
    9.Objects are special kind of arrays that collects data into groups. They are arbitrary collection of properties.
  8. JScript Objects are mutable because their bindings can easily be modified.

SECOND PART

  1. This is difficult to achieve because strings variables are not Objects and they are largely immutable.
  2. Rest Parameter is a function that allows you to input large numbers of arguments at the same time. it is denote by writing three dots in front of the function expression.
  3. Serialization is a process of converting data in flat descriptions for storage and transfers.
    5.JSON - JavaScript object notation; is a serialization format or function built in JavaScript.
  4. Objects names are quoted, comments are not allowed, only simple data expressions are allowed. Anything that involves actual programming computation are not allowed - function calls, bindings.
1 Like

FIRST PART

  1. Variable types such as strings and integers may only log unilateral data. Where there is a circumstance where we need to perform analysis on multiple components such as a list of events occurring during a day, we need to use an array. Using objects, we can compare the array of events occurring during a day to a day where they become a squirrel. Where the data-set is large enough, we can perform correlation analysis to see which events have the highest correlation to when they become a squirrel. With regular variable types such as strings or integers, we can not group data to perform this correlation analysis; we need to use objects to assign (group) days where they became a squirrel to the events that occurred that day.

  2. Using Objects, we can group together the individual days where they did/did not become a squirrel and the events that occurred during each of these days. The list of events which occur on each day are entered into a daily event array.

  3. A property in JavaScript is the name of a particular attribute in an Object. A property will typically contain one or more values.
    So for example, you were to make a person into a JavaScript object, you could list out a number of properties, such as: “name”, “age”, “friendsNames”, “career”, “parentsNames”, “birthDate” etc. and assign values to each of these properties.
    These properties can assist with looking for data within objects, for example, console.log("person.name"), which would print to the console the value assigned to the object’s “name” property.
    It’s worth noting that a value assigned to a property can be a function, e.g. Math.min is a function built into javascript, where Math is the object, min is the property, and the function to find the minimum value of a given argument is the value assigned to the min property.

  4. Any value which is null and undefined does not have properties. Any query here will fire a TypeError.

  5. We can access properties in a value using either:

    • Dot Notation: return object.property;
      When using the dot notation, the word after the dot (.) must be the literal name of the property.
    • Bracket Notation: return object[“property”];
      Bracket notation is particularly helpful when you don’t know the name of the property, and you can use an index to access data in an array or object. When using square brackets, what is inside the brackets is evaluated to get the property name. The difference between the two is that the property name must be clearly stated with dot notation, whereas bracket notation can evaluate whatever is in the brackets to find the property name.
  6. Methods are properties which hold a function as a value. This means that if you were to have some variable, JavaScript can assign a method property to it. You can perform a method on a variable by calling it after a variable and concatenating with a dot, e.g. variable.method();
    It’s important to know that a programmer can create their own methods by creating a function and assigning some name to it, where the function parses when you program it to a variable with a dot, followed by the function name: e.g. return variable.customMethod();

  7. An object is a JavaScript bucket of properties with values assigned to each property. An object categorises data where it can pertain to for example, a user, a person, a day etc. and the metadata is the individual properties and assigned values.
    For example, if a person, Jeff is an object, we can define them as follows:
    let jeff = { name: "Jeff", age: 35, address: "15 Bevan Cres", city: "New York", friendsNames: ["Bevan", "Shazza", "Sam"] };
    So in this example, we have a collection of data pertaining to jeff, and we can access particular pieces of data pertaining to him through calling a property or method, such as return jeff.age(); which would return 35.

  8. It is tricky to perform deeper mathematical analysis on JavaScript items which are not in an object. When you have the benefits of categorising data into objects, it opens up huge potential to create certain algorithms on these objects. For example, calculating correlation analysis with various properties and values for each given day.
    The alternative would be to create a number of unilateral variables, for example: var jeffName = "Jeff", var jeffAge = 35, var samName = "Sam", var samAge = 25 etc. It’s clear to see that there are cataloguing issues here, and this can limit the opportunities available to a programmer.
    This also comes with scaling issues if you wanted to perform program-wide functions replacing placeholders with object names.

  9. Objects are defined like any other variable, however the variable value (contents of the object) is to be housed in curly braces {object}, such as follows:
    let variable = { prop1: "value1", prop2: "value2", prop3: interger3, prop4: ["arrayval1", "arrval2", "arrval3"] };

  10. While specific values of a property included in a JavaScript object are mutable, an object in it’s entirety is immutable. This means that you can not redefine a whole new object, however individually, properties within an object may be able to change.
    let score = {home: 1, vistors: 2};
    You can not do the following: score = {home: 1, vistors: 3};
    However, you can do the following: score.visitors = 3;
    And then console.log(score) will print {"home": 1, "visitors": 3};
    This has flow on effects where even if two objects have the same properties and assigned values, they are not equivalent. such that if:
    let score1 = {home: 1, vistors: 2};
    let score2 = score1;
    let score3 = {home: 1, vistors: 2};
    and if return (score1 == score2) returns true,
    However return (score1 == score3) returns false, even if they technically contain the same properties and values.

SECOND PART

  1. Strings are not a type of object and are immutable, therefore you cannot add new properties to a string value. String values are known as primitive type.

  2. Rest parameters are a placeholder for arguments which are to be placed into the function whilst calling it. When composing the function, the programmer can add a rest parameter such as …numbers, or …letters (the three dots … followed by argument is how to define a rest parameter) into the function argument. A rest parameter could be used in an example such as,
    function restExample(...words) = {console.log("Help me get" + ...words + "to the chopper!")};
    So if you were to call:
    restExample("James ", "Phillip ", "Bevan ");
    The console will print:
    Help me get James Phillip Bevan to the chopper!
    Whilst this is a primitive way of showing how rest parameters work, you can get an understanding through observation.
    The benefit of rest parameters is that it does not limit the amount of arguments that can be placed into the function when calling it.

  3. (Feel free to skip the sub-chapter of Math object and Destructing)
    How dare you tell me what to do! :nerd_face:

  4. Serialisation is flattening data into a purely readable format where no calculations take place and a program can fetch data points from serialised data sets and use them accordingly. This is a flat description of the end-point of data and it means that a computer does not need to use as much memory to store data.

  5. JSON stands for JavaScript Object Notation. JSON is a serialised description of data which is used for data storage and communication of the web. When looking at data transferred through API’s, JSON is particularly popular and a JavaScript program can easily fetch and decipher JSON data.

  6. There are no function calls, bindings or any computation in JSON, nor are comments allowed.
    When writing an object in plain JavaScript, it is not necessary for the programmer to enclose each property in quotations.
    JSON is structured where each property contains double quotations for each property name. e.g.:
    Plain JavaScript
    let jeff = {name: "Jeff", age: 35, city: "Darwin"};
    JSON
    jeff = {"name": "Jeff", "age": 35, "city": "Darwin"};
    Notice each of the property names is enclosed in double brackets in JSON, but not plain JavaScript.
    JSON is typically the data endpoint which has been evaluated from calculations. Transmitting data through JSON means that a client does not need to perform the necessary algorithms, and it just needs to show what is required by using data from a JSON file. It causes much less strain on the client and the network performs much more efficiently as JSON files are typically lighter than pure JavaScript files.
    If plain JavaScript was transferred from servers to the clients, the UX would be sluggish and typically prone to more errors depending on browser dependencies.

3 Likes

Excellent answer @jak.

Keep up the awesome work! :smile: :partying_face:

1 Like

Thanks mate! Getting through the chapter and writing this answer definitely took me a fair chunk of the afternoon! :cowboy_hat_face:

1 Like
  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?

Irregular occurrences.

  1. What variable type can be used in order to solve the problem of storing multiple values?

Arrays.

  1. What are properties in Javascript?

Properties describe and/or are accessed from values and objects. For example, in the expression myString.length, length is a property of myString

  1. Which values do not have properties?

Null and undefined do not have properties.

  1. How can we access properties in a value (two ways)?

We can access properties either with . or [ ]

  1. What are methods?

Methods are properties that contain functions.

  1. What are objects?

Objects are arbitrary collections of properties.

  1. 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 solve whether Jacques turned into a squirrel or not. A list of activities, along with boolean values, combined in a way that are grouped together into one value and then added to an array is a level beyond the basic values we’ve heretofore studied thus far.

  1. How do you define an object?

An object can be defined using an object initializer, which is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}):

  1. What can you say about the mutability of Javascript objects?

Mutability = “true”.

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:

  1. Why can’t you add new properties to a string variable?

It is impossible, as the string value will aways remain the same. For instance, the value,

“cat”, cannot have code written to change a letter in that value to become “rat”.

  1. What are rest parameters?

Rest parameters are parameters that allow any number of arguments, noted with ‘…’

preceding the argument.

  1. What is serialisation and what is a use case of serialisation of data?

Serialisation converts data stored in memory from a program into a flat description, so that it can be more easily stored and communicated with over the web, in the event, or

use case where you’re sharing your code with other developers on the team.

  1. What is JSON?

JavaScript Object Notation.

  1. What are the differences between JSON and the way programmers write objects in plain Javascript?

JSON property names must all use double quotes and only simple data expressions are allowed-no function calls, bindings, or anything that involves actual computation. Also,

no comments are allowed either.

1 Like

1.Jacques wants to to create a datastructure. In theory it is possible to code it as a string but the problem is that you would have to convert the strings back to integers in order to access them. So it is better to create an Array.
2. We can create an array in order to solve the problem of storing multiple values.
3. A Javascript propery is a characteristic of an Object, often describing attributes associated with datastructures.
4. Null and undefined.
5.We can access properties with a dot and square brackets.
6.Methods are properties that contain functions they are generally called methods of the value they belong to.
7.Objects are standalone entities they can have properties and values and they can contain mehtods.
8. In Jacques case an object would be the better choice because each entry needs to store a list of activities and a Boolean value that indicates whetherJacques turned into a squirrel or not.
9. var person = {firstname: “John”, lastname: “Doe”};
10. When a javacript object is mutable that means that we can change their properties, causing a single object value to have different content at different times.

Second part:

1.Because values of the type integer, string and boolean are not objects they are immutable.
2.For some Functions it is useful to have any number of arguments. In this case the rest parameter is useful because when this function is called the rest parameter is bound to an array containing all further arguments.
4.Serialization is a technique for describing a data structure with information about the structure itself embedded in the data. JSON is a lightweight type of serialization, e.g {prop:{prop:1}} . Transfer that to another computer and minimally you can then work with that object’s properties with the same basic relationship of prop.prop
5. Javascript object notation is used to store data and to communication format on the Web.
6. 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, oranything that involves actual computation

1 Like

Haha I think it’s good to be detailed. So much as to break them up between days!

  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?
    Introduces the need of storing information on data structures conceived/adapted for a specific task.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    Arrays are capable of storing multiple values of the same type.

  3. What are properties in Javascript?
    Properties are attainable in almost all JavaScript values.

  4. Which values do not have properties?
    Null and undefined don’t have properties.

  5. How can we access properties in a value (two ways)?
    Properties can be accessed with a dot or square brackets.

  6. What are methods?
    Methods are properties that contain functions.

  7. What are objects?
    Objects are 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)?
    *Objects allow customizing a data structure to tailor a specific model by using several data types under a single label/value.

  9. How do you define an object?
    An object is defined by using braces as an expression to contain its properties.

  10. What can you say about the mutability of Javascript objects?
    By using let one can change the value the binding points at.
    Though a const binding to an object can itself not be changed, and continue to point to the same object, the contents of that object might change.


  1. Why can’t you add new properties to a string variable?
    Strings are immutable. You can combine them and derive new values from them, but their value remains the same.
    Values of type string are not objects, and if you try to set new properties on them, it doesn’t actually store those properties

  2. What are rest parameters?
    Rest parameteres are represented by three dots ("…") before the function’s last parameter, wich makes it bount to an array containing all further arguments.

  3. What is serialisation and what is a use case of serialisation of data?
    Data serialization refers to a conversion of data to a flat description, like JSON and it is used as data storage and communication formant on the web, in multiple programming languages.

  4. What is JSON?
    JSON is restricted way of writing arrays and objects. Names have to be surrounded by double quotes and nothing that involves computation is allowed.

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON takes a dictionary (map) type of approach using key value pairs to store diffent types of values. As a kind of big string appearence, not allowing functions, bindings, comments and computations.
    Lookwise JavaScript is similar but without the extensive quote usage.

1 Like