Data Structures (Arrays and Objects) - Reading Assignment

Part I
1.) Variable types like strings and integers are only values. In the context of the subchapter, it would be the equivalent of writing down ‘oak’ or ‘walnut.’ What Jacques needs are to find the conditions, because he believes that something he does triggers the transformation. For instance, if he avoids oak trees, he doesn’t avoid transformation.
2.) Arrays store a sequence of values.
3 & 4.) Properties are characteristics of a value. Null and Undefined do not have properties.
5.) We can access properties by using a dot (.) after the value to access the property of that value (for example, string.length returns the length of the string) or also the use of square brackets (array[2] returns the 3rd item in an array)
6.) Methods are properties that contain functions. (Example: .push() or .pop() methods of adding/removing a value from an array)
7.) Objects are arbitrary collections of properties.
8.) Objects can grasp values and assign multiple properties. They can contain different data types.
9.) We create objects by using curly braces as an expression
10.) Objects in Javascript are mutable, because you can change their properties. Object values can have different content at different times.

Part II
1.) A string variable is immutable, so you are unable to change its contents.
2.) Rest parameters are bound to an array containing all further arguments.
3.) Skip
4.) Serialization is converting data into a description so it can be sent over a network or put into storage (such as a file folder).
5 & 6.) JSON (JavaScript Object Notation) is a serialization format that converts data to and from the transferrable format. JSON only allows simple data expressions, so functions, bindings and computations cannot be converted.

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?

Dot notation only works with names that look like valid binding names. You can’t use the dot notation with numbers and usually want to use a binding that holds the index anyways, you have to use the bracket notation to access arrays. Also you cannot access null and undefined properties.

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

An object can be used to solve the problem of storing multiple values.

  1. What are properties in Javascript?

The length of a string is a property in Javascript. Also, a

  1. Which values do not have properties?

null and undefined properties.

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

Dot and square brackets. Both value .x and value[x] access a property on value–but not necessarily the same property. The differences is in how x is interpreted. When using a dot, the word after the dot is the literal name of the property. When using square brackets, the expression between the brackets is evaluated to get the property name. Whereas value .x fetches the property of some value named “x”, value [x] tries to evaluate the expression x and uses the result, converted to a string, as the property name.

  1. What are methods?

String and array values carry properties that hold function values. Properties that contain functions are generally called methods of the value they belong to, as in “toUpperCase is a method of a string.” Some other examples of methods (which are functions that can be performed with strings or values would be push and pop method with arrays. Methods are functions that live in properties and (usually) act on the vale they are a property of.

  1. What are objects?

An object is 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)?

They can store a list of activities or events that cannot be stored by integreters, strings, arrays, or boolean expressions, etc.

  1. How do you define an object?

One way to create an object is by using braces as an expression. Inside the braces, there is a list or properties separated by commas. Each property has a name followed by a colon and a value. Indenting can help with being able to read the code.

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

Numbers, strings, and Booleans are all immutable–it is impossible to change values of those types. When you take a specific string value, that value will always remain the same. Objects however, work differently. You can change their properties causing a single object value to have different content at all times. 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 objects have the same value, but live different lives they are said to have the same identity.

SECOND PART:

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

Because they are immutable and cannot be changed. Although the language doesn’t complain, it doesn’t store those properties.

  1. What are rest parameters?

The rest parameter is bound to an array containing all further arguments. It accepts the maximum of all the arguments. It is written by placing three dots before the function’s last parameter.

  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?

Serializing the data means converting it over to a flat description.

  1. What is JSON?

JavaScript Object Notation. It is widely used as a data storage communication format on the Web, even in languages other than JavaScript.

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

Integers and strings can only hold a single type of data, arrays are more flexible in this case since they can hold multiple kinds of data in a single variable.

  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?

Characteristics of values in a data structure.

  1. Which values do not have properties?

Null and undefined.

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

With a dot and square brackets.

  1. What are methods?

Properties that act as functions.

  1. What are objects?

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

Objects are way more flexible, they can hold various types of data types.

  1. How do you define an object?

Using braces as an expression

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

Its value can change, unlike strings.

Part 2

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

Its value cannot be changed as it stays as originally assigned.

  1. What are rest parameters?

Used to accept any number of arguments. (…)

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

Turning data into a suitable format for network/storage transfering.

  1. What is JSON?

JavaScript Object Notation.

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

JSON is simpler.

1 Like

Part 1:

  1. The problem requires a data type that can store a sequence of values.
  2. An array.
  3. Properties are characteristics of values, such as length.
  4. null and undefined.
  5. Using a dot like value.x or brackets like value[x].
  6. Methods are properties that contain functions. For example, toUpperCase() is a method of a string.
  7. An object is a data structure that contains an arbitrary collection of properties.
  8. Objects can store many different types of data.
  9. let object = {item1: value1, item2: value2};
  10. Objects can have their values changed.

Part 2:

  1. Strings are not objects and are immutable.
  2. A rest parameter is bound to an array containing al further arguments.
  3. Serialization is converting data into a flat description. It is used for data storage and communication on the web.
  4. JSON stands for JavaScript Object Notation. It is used as a format for storing data and communicating on the web.
  5. All property names have to be surrounded by double quotes, and only simple data expressions are allowed.
1 Like

PART ONE:

  1. A variable can only store a single value at a time and, creating new variables for storing each value in the data can be tedious.
  2. An array can store multiple values of the same type of variable, allowing information to be stored efficiently.
  3. Properties are expressions used to access a property of some value. An example of a property is string. length, where the string’s length is a property being accessed.
  4. Nearly all values have properties except for null and defined values. Attempting to access the properties of these values will create an error.
  5. The first method involves placing a dot after the value’s name and, the second method involves putting square brackets after the value’s name. Inside the square brackets contains an expression that is evaluated to get the property name.
  6. A method is a function that is contained in certain properties of a value. An example of a method is the .toUpperCase() property, which capitalizes all the letters in a string. This function does not require any arguments because it is a property of every string value.
  7. An object is a type of value that has an arbitrary collection of properties.
  8. Objects allow users to store different value types as a collection of properties in the same variable.
  9. They are defined by using curly braces as an expression. For example, an object car can be defined by inserting properties separated by commas inside the curly braces:
    var car = { make: "BMW", year: "2019", type: "Sedan" };
  10. Objects are mutable, meaning their property values can be changed at any time. This is done by assigning a new value using the = operator. This will replace the property’s previous value or assign a new value.

PART TWO:

  1. A string is a primitive value whose properties cannot be changed or added because they are immutable.
  2. Rest parameters are a type of argument used in functions for providing an array of values. The rest parameter is an argument that is bound to an array containing all further arguments. Any arguments provided before the rest parameter will not be included in its array.
  3. Serialisation is a conversion of memory addresses into a flat description. An important use-case would be saving data (such as objects or arrays) in a file, or send it to another computer over the network.
  4. A popular format used for serialization in JavaScript is called JSON (JavaScript Object Notation).
  5. When creating objects in JSON, there are few restrictions. It is always required to surround a property’s name with double quotations, and only avoid using complex data expressions such as function calls, bindings, or any other expression that requires computation. Also, no comments are allowed in JSON.
1 Like
  1. A data structure is needed to store different values to a single binding. Variable types such as strings or integers only hold on one value.

  2. An array.

  3. Properties are named values in JS objects. For example: var people = {firstName: “Tom”, age:30} - firstName and age are the properties.

  4. “null” and “undefined”

  5. With a dot or square brackets. value.a or value[a]

  6. Methods are actions that can be performed on JS objects. It’s a property containing a function definition.

  7. Almost everything in JS is an object. Dates, maths simple expressions, arrays, functions and objects are objects. If defined with the new keyword then booleans, numbers and strings can also be objects. All values, except primitives, are objects.

  8. Objects can store different values to a single binding.

  9. You can define an object by using curly braces as an expression. For example: let people = {firstName: “Tom”, age:30, food: [“pizza”, “ice cream”]}

  10. JS objects can have different values at different times, therefore it’s mutable. Only numbers, strings and booleans are immutable.


  1. A string is a primitive data type, which is data that has a primitive value. Primitives values are immutable and have no properties. Also primitve data types are number, boolean, null and undefined.

  2. The rest parameter allows a function to receive an indefinite number of arguments as an array.

  3. Serialization means to convert an object into that string, which is needed to exchange data between browser and server, because data can only be text.

  4. JSON is a syntax for storing and exchanging data.

  5. In JSON all property names have to be surrounded bv double quotes and only simple data expressions are allowed. Comments are also not allowed.

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?
    It is needed to storage a lot of data.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    It could be used an array and an object.

  3. What are properties in Javascript?
    The value associated with and object.

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

  5. How can we access properties in a value (two ways)?
    for example if we have an array, demoArray = [2,5,9];
    we can access a property of this array by demoArray[0];
    or we can access another property using dot like demoArray.length;

  6. What are methods?
    They are properties that contain functions. For example *let word = “doh” ;
    word.toUpperCase(); * This property change all the letters of the string to upper case.

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

  9. How do you define an object?
    It is a variable that contains a collection of properties and methods.

  10. What can you say about the mutability of Javascript objects?
    Mutability means that objects properties can be changed.

  11. Why can’t you add new properties to a string variable?
    The values of a string are immutable and cannot be changed.

  12. What are rest parameters?
    It is a “tool” to allow functions have any numbers of arguments.

  13. What is serialisation and what is a use case of serialisation of data?
    serialisation is to convert the data into a flat description to be able to store or send.

  14. What is JSON?
    It is a serialisation format.

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

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?

Variables and strings can store only one property or value. We need something that can store more than one value.

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

Arrays, it allows us to store more than one value in an variable using the [ ] and separating all itmes with a comma.

  1. What are properties in Javascript?

Properties are almost like the content of a value. Some expression access the properties of some value like, .length or .min or .max, etc.

4 . Which values do not have properties?

null and undefined. If you try to access a property on one of these non value it will result in an error.

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

Two common ways is the dot and the square brackets.

6 . What are methods?

Methods are properties that contain functions.

7 . What are objects?

Object are arbitrary collections of properties, and we can add or remove these properties as we want.
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?

Inside the curly braces, we can give a list of properties separated by commas. Each property is written as a name, followed by a colon, followed by an expression that provides a value for the property.

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

With objects the content of the value can be modified by changing the properties.

SECOND PART:

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

The values are immutable and cannot be changed

2 . What are rest parameters?

The rest parameter syntax allows 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)

okay.

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

The serialization changes the object state into series of bits. The object state could be reconstructed later in the opposite process, called deserialization. This makes data transferable over networks or storage.

5 . What is JSON?

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

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

It is similar, except there are a few restrictions in Json, like: All property names have to be surrounded by double quotes and only simple data expressions are allowed.

1 Like

I.

  1. Storing multiple data into groups
  2. Array
  3. Properties are expressions that access a property/definition of a value
  4. null and undefined
  5. value.x or value[x]
  6. Methods are properties that contain a function
  7. An object is a collection of properties
  8. Grouping together of similar terms/values
  9. let objectName = {keyOne:value, keyTwo: value}
  10. Object values unlike other data types like numbers, strings, and Booleans, are modifiable

II.

  1. Because strings are not objects
  2. Parameter used in a function to accept any number of arguments
  3. Serialisation converts data into a flat description instead of it being represented as memory addresses, this is useful when sending data/files to a different computer in the network
  4. JavaScript Object Notation
  5. JSON properties need to be enclosed in double quotes and only simple data expressions are allowed
1 Like
  1. The problem introduced that cannot be solved with strings or integers is that each single value in the data set contains a group of values within that single value. This means that in order to organize more complex data points like where i’ve been and whether or not I turned in to a squirrel in one data point, we will need an array that can allow us do just that.

  2. Arrays can be used to store data sets of multiple values.

  3. Properties in JavaScript are functions that

  4. Null and Undefined are values that do not have properties.

  5. The two ways of accessing properties in a value are through using .(and the value following the period) or by using square braces [ value ].

  6. Methods are properties that hold a function, e.g. toUpperCase is a property that holds a function that when called, will turn the letters in a string to upper case letters.

  7. Objects in JavaScript are data sets that comprise of more than just a string or an integer in the array but can be these things plus a boolean value all represented by a single value “x” for example as the properties inside the braces.

  8. What objects solve is that they can hold different types of data within the data set. Not holding only strings or integers, but strings, integers and boolean values for example allowing arrays to contain more data within it.

  9. Objects are defined similar to any other variable in an array which is that they must be contained within braces.

  10. Outside of objects, values like strings and integers cannot be changed but can be combined to derive new values from them. 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”. Objects however work differently in that you can change their properties causing a single object value to have different content in different times.

SECOND PART

  1. Unless the value is an object, new properties cannot be added to that element, same rules apply for strings as they are immutable. However, you can concat a string with another value and this can produce a different string.

  2. A rest parameter is a function that is bound to an array containing a number of arguments. It is written with three dots before the functions last parameter (… numbers)

  3. Serialisation is the process of converting data from JavaScript (bits of code stored somewhere in the computer’s memory) into a flat description that can be sent to another computer.

  4. JavaScript Object Notation is a common serialisation format used for data storage and communication

  5. All property names in JSON need to be surrounded in double quotes, and only simple data expressions are allowed - no function calls, bindings, or anything that involves computation.

1 Like

11- Anylising a series of event
12- Objects
13- Properties are characteristic of values
14- Null and undefined don’t have properties
15- value.property OR value[property]
16- Methods are functions which are properties of values
17- Objects are collections of property arbitrary set
18- Grouping values of different type together into a single value
19- using braces, inside the braces property are defined using : and separated by ,
110-the properties of object can change
21-A string is immutable
22-the rest allows to define a function with an unlimited number of parameter
24-Serialisation is a method to transfer or store data, it flatten a serie of data.
25-JSon is a type of serialisation used on JS but also elsewhere
26-property names are to be in brackets, there a no ciomputation (formula, bindings etc.)comments also are not allowed

1 Like
  1. The problem introduced by this chapter that cannot be solved by strings and integers is that of “grouping values together into a single value”.
  2. By the use of data of the type “Object”.
  3. The “name:value” pairs in Javascript Objects.
  4. By the dot notaion(i.e objectName.propertyName) and by the square bracket notation(i.e objectName[“propertyName”]
  5. Null and Undefined
  6. Methods are actions that can be performed on Objects. They are stored in properties as function definitions.
  7. Objects are Javascript variables that store many values.
  8. Objects can store different types of values including objects.
    e.g myObject = {
    string : “string”,
    number : 1,
    anObject : [“apple”, “banana”],
    }
  9. An can be defined using an object literal as seen in 8 above.
  10. Javascript Objects values can be modified, properties can be added and deleted as we please.

SECOND PART

  1. String values are immutable. They are be combined to produce new values but a string value of “me” cannot be changed to spell “you”.
  2. The 3 dots prepended to parameters that allows us to gather any number of arguments into an array and manipulate them.
  3. Serialisation is flattening of data so that it can transferred over a network.
  4. JSON stands for Javascript Object Notation. It is used as data storage and communication format on the web.
  5. The difference is that a JSON object property names and property values must be in double quotes. And JSON property values must contain only simple data types e,g strings and numbers.
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?
    Tying multiple data points together to create objects.
  2. What variable type can be used in order to solve the problem of storing multiple values? Objects.
  3. What are properties in Javascript? It is a name and value for a specific piece of data.
  4. Which values do not have properties? Null and Undefined
  5. How can we access properties in a value (two ways)?
    Using a .function or [“prop”]
  6. What are methods? Properties that hold functions.
  7. What are objects? A way to group several properties into one.
  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)?
    It is a non-type structure that allows many values to be stored and called upon.
  9. How do you define an object? {[x:1, y:3, z:4]}
  10. What can you say about the mutability of Javascript objects? They are mutable in that they can change over time depending on how the user defines and uses them.

SECOND PART:

  1. Why can’t you add new properties to a string variable? because it has a definition and is not an object so it won’t take on new properties.
  2. What are rest parameters? It allows a function to take in an unlimited number of arguments or short hand notation for plugging in the whole of an array.
  3. What is serialisation and what is a use case of serialisation of data? It is a method to convert data into a flat number like structure.
  4. What is JSON? A file type that makes it easy to transmit data packets over the web.
  5. What are the differences between JSON and the way programmers write objects in plain Javascript? There is no computation or function calls, and there are no comments allowed.
1 Like

1 - Variables such as strings and integers are useful for handling very limited datatypes and single values. To be able to handle multiple values and a wider range of datatypess we need to use very specific datatypes.
2 - These datatypes are called arrays.
3 - Properties are values associated with objects and are used to define what the values in a data structure mean.
4 - Null and undefined are values that do not have properties.
5 - To access properties we need to either use a ‘dot’ or ‘square brackets’ - ‘value.’ and ‘value[x]’ both access properties. The word that appears after the ‘dot’ is the name of the property - so, ‘value.x’ will find the property of the value named “x”. Square brackets tell JS to look inside the brackets and evaluate the expression to obtain the property name - so, ‘value[x]’ will evaluate the expression “x” and uses the result (produced as a string) as the property name.
6 - Properties that contain functions are called ‘methods’ of the value they belong to. An example of a method is:
let sequence = [1, 2, 3];
sequence.push(4);
sequence.push(5);
console.log(sequence);
// [1, 2, 3, 4, 5]
console.log(sequence.pop());
// 5
console.log(sequence);
[1, 2, 3, 4]
This example shows 2 different ways a method can manipulate values in an array. The push method adds values to the end of the array. The pop method removes the last value in the array.
7 - Object are datatypes that are able to contain an arbitrary collection of properties. Objects are created using braces - [ ] - inside these can be any number of properties, which are separated by commas.
8 - Objects are different than other value types in that they offer mutability - meaning that they can be changed - this allows an object value to have different content during scenarios. This can be useful for programming where you might want a value to change depending the scenario.
9 - Objects are defined using braces, where the properties are separated by a commas, each property is nameed after which comes a colon and the value.
10 - Values such as numbers, boolean and strings are immutable - meaning that they are unable to be changed. These values can be combined to obtain a new value - however, the individual values retain their original value. Objects allow values to be more malleable, allowing the value properties to be changed.

1 - String values are not objects, therefore if you try adding new properties to them Javascript will not store them due to the immutable nature of string values. String values as well as other immutable value types have in-built properties. All string values will have a number of methods such as indexOf and slice.
2 - Rest parameters are used to allow functions to accept an infinite number of arguments. Rest parameter are defined using 3 ellipses(…) before the functions last parameter.
3 - SKIPPED
4 - Objects and arrays are stored within a computers memory in the form of bits which hold the addresses of their contents.
5 - JSON stands for “JavaScript Object Notation”. It used as a data storage and communication format on the Web.
6 - In JSON all property names must be enclosed within double quotes. JSON is limited in that only simple expressions may be used - no functions, bindings or any other computational expressions. JSON also does not support comments - making collaboration between multiple programmers harder.

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?
    There is a need to store a sequence of values rather than single pieces of data.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    An array stores sequences of values.

  3. What are properties in Javascript?
    Properties are types of information that can accessed about the value in an expression.

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

  5. How can we access properties in a value (two ways)?
    You can use a dot or square brackets to access a property. The dot route interprets what comes next as the literal name of the property while using the square brackets causes what is written within to be evaluated to get the property name.

  6. What are methods?
    A method is a property that contains a function.

  7. What are objects?
    Objects are a designated collection 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 can grasp onto multiple value types as part of a collection.

  9. How do you define an object?
    You use curly braces to define an object (usually outside the start of a statement as curly braces are also used in that syntax).

  10. What can you say about the mutability of Javascript objects?
    While most value type are immutable (unable to be changed), objects and their properties are mutable.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    You can’t add properties to a string variable because strings are not objects.

  2. What are rest parameters?
    Rest parameters are functions that can accept any number of arguments.

  3. What is serialisation and what is a use case of serialisation of data?
    Serialisation means to covert data into a flat description. It is used when you want to save data for later or send to another computer.

  4. What is JSON?
    Javascript Object Notation. It is used for data storage and communication across the web.

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    All property names have to have double quotes, expressions must be kept simple with no function calls, bindings, computation, or comments.

1 Like
  1. Our friend needs a data structure to store a sequence of values.
  2. An array can be utilized to solve the problem of storing multiple values.
  3. Properties are expressions that access a property of a Javascript value, as almost all values have properties.
  4. Null and undefined are values that do not have properties.
  5. Properties can be accessed in two ways, one is with a dot and the second is with square brackets (i.e. value.x and value[x]).
  6. Properties that contain functions are generally called methods of the value they belong to.
  7. Values of the type object are arbitrary collections of properties.
  8. They can store different data types, unlike other value types such as string, integer, array and boolean.
  9. An object can be defined by inserting it inside of curly braces.
  10. Numbers, strings and Booleans are all immutable and the values of those types cannot be changed. However, you can change the properties of objects, causing a single object value to have different content at different times.

Second Part:

  1. The string datatype is not an object and therefore does not allow for additional properties, other than those that are built in, such as slice and indexOf
  2. The rest parameter is bound to an array containing all further arguments and you can use three dot notation to call a function with an array of arguments.
  3. Serialization is when data is converted into a flat description, so that you don’t have to convert tangles of memory addresses, where objects and arrays are stored.
  4. JSON or JavaScript Object Notation, is a popular serialization format that is widely used as a data storage and communication format on the Web.
  5. JSON requires all property names to be surrounded by double quotes and only simple data expressions are allowed. No function calls, bindings or anything that involves actual computation is allowed. Additionally, comments are not allowed in JSON.
1 Like
Read the sub-chapter called The weresquirrel.

1. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
   * The need a object/data structure to store multiple variables that are correlated/associated
      (as in the example below in #7  for fruit (object) and properties per entry..)
2. What variable type can be used in order to solve the problem of storing multiple values?
   Arrays
3. What are properties in Javascript?
   objectName.property - a property is a characteristic of a object.
      string.length - gives the length/size of a string [length - 1 = last element since it starts with 0].
   examples are: length, min/max, color
4. Which values do not have properties?
   null and undefined - those will give a error.
5. How can we access properties in a value (two ways)?
   object["length"] or object.length
6. What are methods?
   They are properties that contain functions like: toUpperCase and toLowerCase, push, pop
         Word.toUpperCase() would return WORD
7. What are objects?
   a arbitrary collection of properties..
      fruit: - Object
        Properties:
        a. - color: yellow
           - peel:  yes    // peel to eat versus just eat. or some other similar factor
           - hardness: 4   // 1-10 - where 1 is super soft and 10 being hard
           - size: 5       // 1-10 - where 1 is small like a tiny berry to large like jackfruit
           - name: banana
        b. - color: red
           - peel: either  // peeled or not
           - hardness: 7
           - size: 4
           - name: apple

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)?
   - You can change values in objects
   - objects associate/correlate properties

9. How do you define an object?
   - Define a array, then add entries with values with push/pop or inside of curly braces. "{}"
     let journal = [];
     journal.push({["work", "touched tree", "pizza", "running", "television"], false});

10. What can you say about the mutability of Javascript objects?
   - They are mutable/changeable.. And they can have different states at different times.
     [nubers, strings, booleans and values are immutable]

SECOND PART:
1. Why can’t you add new properties to a string variable?
   strings are not objects and have a single value assigned.
       string frog = "Xenopus laevis";
       Then it is only one at a time.
    frog.length would be a built in that shows you the number of characters.
2. What are rest parameters?
    - useful for a function to accept any number of arguments.
    - you put three dots before the function’s last pa- rameter
      function max(...numbers)
    - rest parameter is bound to an array containing all further arguments

3. What is serialisation and what is a use case of serialisation of data?
    - converted into a flat description
    - used as a data storage and communication format
    - mostly replaced XML for lists of 'data structures' with key->value pairs.

4. What is JSON?
    - A data structure array in a flat file.  JavaScript Object Notation

5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    - JSON requires all property names and data to be in single quotes
    - JSON has no comments
    - It is basically a data file or a configuration file..   No function calls, bindings, no programming
    - also simplistic data only.

Other FYI: (basically config files, data: key:value pairs and data structure files)
   XML --> JSON --> YAML is the newer one.
      YAML is another recursive acronym (like GNU) - YAML Ain’t Markup Language


1 Like

FIRST PART :

  1. Variables like strings and integers are too simple to manage complex situation : the author needs a more complex structure such as a data structure to store several types of data at once.

  2. Arrays, typed arrays or objects lists.

  3. Properties are a way to access information on the data-set or object. For example array.length give us the number of item in the array.

  4. Null and undefined.

  5. Using “.” like array.length and brackets like array[“length”]

  6. Methods are a way to compute a specified function on the data (with parameters or not), for example : array.push(“2”) will add at the end of the array the number 2.

  7. They are a kind of data structure where the developer can create his own methods and properties.

  8. Objects are very useful as they centralize a lot of data and many functions into one entity. We can then call this unique entity and access properties and use methods very easily.

  9. "let object = {header:content, header2:content2} etc…

  10. Mutability of objects mean that properties and methods of an object can be easily modified by the developper. This is sometimes useful but can be risky as data can be lost.

SECOND PART :

  1. As strings are not objects, they are primitive objects just like numbers and booleans. This means that their properties and methods are immutable, thus cannot be changed.

  2. Rest parameters are a useful way to call every item of an object. “…array” will give every item of the array “array”.

  3. Serialization is the process of transforming data from an object to raw data. It’s useful to serialize data when transferring it to another service or computer.

  4. JSON is a serialization format, often used in javascript and web services.

  5. JSON is only readable content like strings, numbers, array and booleans, without commentary.

1 Like

Part 1.

  1. The ability to group multiple data types into one reference value.

  2. An array can hold multiple values and each can be referenced by a index number, myArray[0] for the first value.

    myArray[ 1,2,3,4];

  3. For example a Car can be described as having paint colour red, wheel type and engine size, these are its properties. In JavaScript programming a value can have properties associated with it.

  4. The values null and undefined do not have properties. Accessing the property will return an error.

  5. Either by value.x or by value[x].

  6. Properties that contain functions are called methods, for example myString.toUpperCase() refers to the method toUpperCase.

  7. Objects are a collection of properties associated with a value.

  8. Objects can group multiple data types into a single value.

  9. A series of property; name pairs, referenced by name in the following format.

    var myObj = { aName: aval, bName: bval};
    
  10. The ability to change an object property at anytime is mutable.

Part 2.

  1. Because strings are immutable, unable to change property values.

  2. The Rest parameter allows functions to accept an indefinite number of arguments.

Function myFunc(…theArgs) { code body};

  1. Skipped.

  2. A process whereby an object or data structure is translated into a serialized format suitable for transferring over a network or storage device.

  3. JSON is a data serialization format typically used for Web communication.

  4. Only simple data expressions are allowed in JSON format and property names are surrounded in double quotes. Examples of objects are:

{ x; 5 , y: 6}; JavaScript object.

{“x”:5, “y”:6}; JSON format.

1 Like
  1. The Were-squirrel introduces a need for bindings that contain subgroups of bindings(etc) and a way to recall the values of these bindings as needed.

  2. The variable type that can store multiple values is an array object.

  3. Properties are basically few simple functions of an object or binding that are universal to any value other except Null or undefined and return some characteristic related to that object or value. Examples would be string.length and Math.min

  4. Null and undefined to not have properties associated with them.

  5. You can access a string property by using a period. String.property() Or you could use square brackets such as String [property()]

  6. Methods are functions that are also globally accessed but do not need to be stored as bindings… They generally return some function on the values in their calling string such as string.toUpperCase. string.slice() string.indexOf()

  7. Objects are bindings that contain more bindings in a “bag” as in you can reference all values in an object by simply refering to the object. Much easier that constantly refering to all values seperately.

  8. Objects solve the problem of having to track all similar variables independently. All related variables remain in their container until ready to be accessed.

  9. You define an object the same way you define a binding but with curly braces { } Then inside are property names followed by a colon and value separated by commas.

  10. In javascript two different objects a, b may hold the same value. (a=5,b=5) but are treated seperately unless there is a binding stating one a = b

Second part.

  1. You cannot add new properties to a string variable because it is pure. It is a baselayer. To add a new property it would need to be binded as an object with { } brackets.

  2. Rest parameters are used when using for() loops on arrays. When you pass an object with multiple values as a string to a function, the function will only recognize the first value in the string. The … rest parameters allows the function to call each of the values in the array seperately and perform its function on ALL values in the object.

  3. I read it anyway :slight_smile:

  4. Serialization is the ability to single out a certain subset of data without having to go through ALL data to locate it… It is a map to the desired value.

Serialization saves much un necessary data transfer and time trying to find specific data on a server for example. The serialization would allow the server to just know where the value is stored.

  1. JSON is Javascript Object Notation. It is a way to store data as objects in an external file to be called by script in .html and other file types.

  2. JSON notation is plain and basic… No functions, computation, or complicated notation allowed. Entries are enclosed in { } braces with ALL properties enclosed in quotes" " with : between the value, and separated by commas.

1 Like