Data Structures (Arrays and Objects) - Reading Assignment

Hello sir, excellent answers :slight_smile:, just one little thing, did you forgot to type answer of the 8 question?

Any doubt you have please let us know, we are here to help you!.

Carlos Z.

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. Variables such as strings and integers can only store a single type of data.

  2. ***What variable type can be used in order to solve the problem of storing multiple values?
    A. You would need to use arrays and written as a list of values between square brackets and separated by commas.

  3. ***What are properties in Javascript?
    A. Properties are expressions that access a property of some value. Almost all JavaScript values have properties.

  4. ***Which values do not have properties?
    A. The exceptions are Null and undefined.

  5. ***How can we access properties in a value (two ways)?
    A. The two ways to access properties in JavaScript are with a dot and square brackets.

  6. ***What are methods?
    Properties that contain functions are generally called methods of the value they belong to.

  7. ***What are objects?
    A. Values of the type object 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)?
    A. Objects have values that are mutable or changeable. Integers, strings, arrays and Booleans are immuntable.

  9. ***How do you define an object?
    A. An object is a standalone entity, with properties and type which define their characteristics.

  10. ***What can you say about the mutability of Javascript objects?
    A. Objects values can be modified. You can change their properties causing a single objects value to have different content at different times.

Think about the following questions:

  1. ***Why can’t you add new properties to a string variable?
    A. The values of type strings are immutable.

  2. ***What are rest parameters?
    A. A rest parameter allows us to add any number of arguments as an array of a function. The rest parameter must be at the end of the array.

  3. ***What is serialisation and what is a use case of serialisation of data?
    A. In computing, serialisation is the process of translating data structures or object state into a format that can be stored or transmitted and reconstructed later. It can be used to create a semantically identical clone of the original object.

  4. ***What is JSON?
    A. JSON is a language-independent data format. JSON is a lightweight format for storing and transporting data.

  5. ***What are the differences between JSON and the way programmers write objects in plain Javascript?
    A. All property names need to be surrounded in double quotes and only simple data expressions are allowed. No function calls, bindings or anything that involves 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?
    • Storing a set of data and retrieving it can be awkward when using strings or integers.
  2. What variable type can be used in order to solve the problem of storing multiple values?
    • Array
  3. What are properties in Javascript?
    • Properties are the characteristics of a value.
  4. Which values do not have properties?
    • null and undefined
  5. How can we access properties in a value (two ways)?
    • Can be done via: dot or square brackets. value.x or value[x]
    • Dots are used when when trying to call the literal name of the property
    • Brackets evaluate the expression within them to obtain the property name.
  6. What are methods?
    • Methods are properties of values that hold a function.
  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 can have mutable properties. This allows an object to have different value for a property at different times in the program.
  9. How do you define an object?
    • Objects can be thought of as a container for values and properties. This container can have its content/values changed throughout the program and can only be accessed from the outset using the relevant property names.
  10. What can you say about the mutability of Javascript objects?
    • Values and properties of a javascript object can be changed throughout the program.
  11. Why can’t you add new properties to a string variable?
    • Strings are not objects. Thus they are unable to store any properties, even though the program runs fine if a user mistakenly tries to do so.
  12. What are rest parameters?
    • It allows a function to accept any number of parameters.
  13. What is serialisation and what is a use case of serialisation of data?
    • Serialisation is the converting of data into a flat description.
    • Rather than sending the whole memory address and memory of the computer, serialization is used when trying to send data from one computer to another.
  14. What is JSON?
    • JSON, JavaScript Object Notation, is a popular serialization format. It is widely used as a data storage and communication format for the Web.
  15. What are the differences between JSON and the way programmers write objects in plain Javascript?
    • JSON cannot contain comments
    • All property names have to have double-quotation marks.
    • Only simple data expressions are allowed, no function calls, bindings or anything that involves actual computation.
1 Like

1.) The ability to have a list of object stored as a sequence of values that can be altered like a journal and for each value to have it’s own properties.

2.) Arrays

3.) Attributes of a value.

4.) All values expect Null and Undefined

5.) Either by . or square brackets IE someVar.length someVar[x]

6.) properties that hold function values.

7.) An arbitrary collection of values.

8.) Objects unlike any of the aforementioned are mutable which means that it’s value can be modified.

9.) To me objects are like entries into a database.

10.) Json does not compute so no functions or bindings and values are wrapped in “”.

1 Like

Hi thecil,

Thanks for noticing, I think I overlooked that question. I would say that objects allow a collection of properties or data structures to be bundled into a single data structure (the object) making it easier to process/keep together.

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?
    Strings or integers doesnt allow flow of data gathering that well.

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

  3. What are properties in Javascript?
    Properties for JS are the expressions that can access property values

  4. Which values do not have properties?
    Undefined/Null

  5. How can we access properties in a value (two ways)?
    Dot or Square brackets:
    Brackets obtain properties by evaluating expressions
    Dots obtain properties by the name being classified directly

  6. What are methods?
    Methods are properties that hold the function of a specific value

  7. What are objects?
    Object can be a variable, a data structure, a function, or a method, and as such, is a value in memory referenced by an identifier

  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)?
    Allows their values to be modified

  9. How do you define an object?
    var objectName = {
    property1: value1,
    property2: [arrayValue1, arrayValue2, arrayValue3]
    };

  10. What can you say about the mutability of Javascript objects?
    That they are mutable

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Strings have specific property values and cant be changed unless you change the function of the string

  2. What are rest parameters?
    Rest parameters lets you to set an indefinite amount of arguments in arrays

  3. What is serialisation and what is a use case of serialisation of data?
    serialsation converts specific types of data into a flat description that allows this new flat description to be saved for later or or send it to all memory addresses

  4. What is JSON?
    JSON is serialsation for data communication and storage.

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON needs " " for all property names. JSON doesnt allow actual computation so no function calls.

1 Like
  1. Strings and integers are separate, single type of data that cannot interact with each other in easy and organised way. Where we need to input chunks of different types of data that need to interact with each other and give the correct outputs.

  2. Arrays can be used to store multiple values.

  3. In Javascript properties are the characteristics of the object or value.

  4. Null and undefined values does not have properties.

  5. Two main ways to access properties in Javascript are with a dot and with square brackets.

  6. Methods are properties that contain functions to the value they belong to.

  7. Objects are arbitrary collections of properties of the value.

  8. Objects can hold any data types together. Analogy: like octopus where each leg is a different type of data.

  9. Defining object can be done by using braces as an expression.

  10. Values in objects can be changed which means they are mutable, where other types of values like numbers, strings and booleans are immutable.

SECOND PART

  1. String values are immutable.

  2. Rest parameters can be used for a function to accept any number of arguments by writing three dots before the function’s last parameter.

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

  4. Serialisation is data converting from computer’s memory addresses into a description that can be stored and sent. Serialisation of data is necessary to be able to save your code or send it over to another computer over the network.

  5. JavaScript Object Notation aka JSON is widely used as a data storage and 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, or anything that involves actual computation. Comments are not allowed in JSON.

1 Like
  1. Storing different types of value in a string would not be possible because a string can only contain one value. If you would put numbers with spaces in a string and would later like to access the information of one of the numbers, you’d have to somehow take out the digit and convert it to a number again. That wouldn’t be efficient enough.

  2. Arrays. They are used for storing sequences of values.

  3. Properties in Javascript are expressions that access the property of some value.

  4. All values have properties except null and undefined.

  5. by using a dot or square brackets e.g value.x and value[]

  6. Methods are properties that hold the function of a value.

  7. Values of the type object can store as much information as possible.

  8. With Objects, it is possible to change the values of an object at any time you want.

  9. You can create objects by using braces as an expression.

let example = {
            myExamples: true,
            examples: ["example1", "example2", "example3"];
          }
  1. Strings, booleans, and numbers are immutable that means that it is impossible to change values of those type. While objects are mutable, so you can change their value after they have been defined.

SECOND PART:

  1. Because strings are immutable so they can’t be changed but, they have build-in properties that are methods like e.g slice and indexOf.

  2. Rest parameters are called when you use three dots before the function’s last parameter. Rest parameters accept any number of arguments.

  3. Serializing the data means that it is converted into a format that is suitable for transferring data over to a network or storage.

  4. JSON is a popular serialization format that stands for JavaScript Object Notation. It is most of all used to store data, and as a communication format on the web.

  5. The difference is that in JSON only double quotes can be used to surround property names. No function calls, bindings, computation, or comments are allowed in JSON. only simple data expressions are allowed.

1 Like

First Part:

  1. Sometimes storing together different type of arbitrary data is needed. Sometimes we need to put together and grasp different kinds of variable.
  2. Objects, that allow to store multiple values and objects together.
  3. It is a quality of a value.
  4. All JavaScript values have properties except null and undefined.
  5. Using value.x or value[x]. The first gets the property of value named literally. And the second evaluates an expression and return the result converted to a string, as the property name. We must use this way when we are dealing with names that don’t look like a valid binding name – because it has a white space or cause it’s a number for example.
  6. Properties that contains functions are generally called methods of the value they belong to. toUpperCase is a method of string.
  7. Objects are arbitrary collections of properties.
  8. Allows us to build data structure to approach any kind of situation.
  9. Object is an octopus with multiple tentacles, each of them with a name tattooed in it. What every tentacle grasp can change depending our necessities.
  10. Objects are based on identity, related to its binding name and its references. No matters the value or the property that these references may have at some point. Comparison in objects are related to its identity, not to the values or properties that they grasp.

Second part:

  1. Because is not an object. Is an immutable value and it only has built-in properties such as lenght. It can not store properties.
  2. A way to indicate an array of arguments as a parameter in a function. Is it called with …arrayname.
  3. Ok. Done.
  4. Is a way to store and send data to others. Serializing data is converting a tangles of memory adressess, containing objects and arrays, to a flat description.
  5. JavaScript Object Notation. It is a widely used data storage and communication format.
  6. Is quite similar. 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- Because “strings are immutable”.
2- An array
3- They allow us to access info about an expression.
4- Null, undefined
5- dot, [ ]
6- Properties that contain functions
7- Arbitrary collections of properties.
8- An object can contain different types of data
9- With a pair of [ ]
10- You can change their properties so they can have different content at different times


1- Because they are immutable
2- It allows us to represent an indefinite number of arguments as an array.
3-
4- Means data is converted into a flat description. Simplifies data storage and transfer
5- A system of data storage and communication on the web
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 not allowed in JSON.

1. Read the sub-chapter called The weresquirrel. What problem does this chapter introduce that cannot be solved with variable types such as strings or integers?

Need to adopt a scientific approach to collect store data in a data structure in order to narrow down the conditions that trigger the irregular occurrences of transformation.

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

An array is a data type specifically for storing sequences of values. 

3. What are properties in Javascript?

A property of some value is accessed through an expression (ex. myString.length (to get the length of a string)) 

4. Which values do not have properties?

Null and undefined do not have properties, they are considered non-values.

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. Ex. value .x and value[x]
 
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 

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?

One way to create an object is by using braces as an expression.

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

Since object values can be modified, they are mutable.  In comparison, types of values such as numbers, strings and Booleans are all immutable (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.

In sub-chapter called Strings and their properties

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

Values of type string, number, and Boolean are not objects, it does not actually store those properties.  Such values are immutable and cannot be changed.

2. What are rest parameters?

The rest parameter is bound to an array containing all further arguments.

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

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

Serialize the data means to convert it into a flat description.  It is widely used as a data storage and communication format on the Web.

5. What is JSON?

JSON is a popular serialization format which stands for JavaScript Object Notation.

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

The difference is 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

Think about the following questions:

  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. These records of dates, creature states and specific activities need to be stored in a way that can be searched, indexed, and manipulated to perform computations. A string or integer do not provide these provisions, as the record itself requires an array object.
  2. What variable type can be used in order to solve the problem of storing multiple values?

Use an integer array.

  1. What are properties in Javascript?

These are attributes of a data type that allow us to better understand the data (ex. String has length, Math has min, max and avg )

  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 built-in functions that enable data to be manipulated (upper, lower)

  1. What are objects?

Values of the type object 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)?

Ability to store a record of entries of common type vs. discrete forms of isolated data

  1. How do you define an object?

Arrays are just a kind of object specialized for storing sequences of things.

  1. What can you say about the mutability of Javascript objects? Objects work differently. You can change their properties, causing a single object value to have different content at different times.

Think about the following questions:

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

We can’t extract the digits and convert them back to numbers to access them.

  1. What are rest parameters?

Rest parameter is bound to an array containing all further arguments

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

Serialization is converting all the data to a flat type that can be shared with other devices/systems (use case).

  1. What is JSON?

JSON stands for JavaScript Object Notation . It is a widely used as a data storage and communication format on the Web to share data.

  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

PART ONE:

The problem of not being able to store multiple values of different types in variables that can only hold strings or integers.

Object variables and Arrays

Properties are name:value pairs in objects. Objects hold property values that are assigned to specific property names.

By dot notation or by squared brackets.
objectName.propertyName
or
objectName[“propertyName”]
If we have a property name that is an integer or a string that contains a space, we must use squared brackets to access them.

Methods are actions that can be performed on objects. We can write and store functions in objects and apply them or we can use JavaScript built in functions such as toUpperCase().

Objects are variables that can store multiple amount and different types of data.

Objects can hold different types of data, that we can add to, update, delete or reference.

We use curly braces {}, and between them we use name-value pairs with colons between them. Each name : value pair is then separated by commas.

Objects in JavaScript are mutable, they can be deleted, added to and property values can be updated easily.

1 Like
  1. The ability to store multiple values of different types.

  2. Array.

  3. Properties are values that can be accessed by using the “.” operator. You can use them to get the length of a value or the maximum value of an array for example.

  4. Non-values like null don´t have any properties.

  5. By using the “.” operator or by wrapping the property inside brackets “[]”.

  6. Methods are properties that contain functions.

  7. An object stores a collection of properties.

  8. They can grasp and let go of as many different values and datatypes as we need them to.

  9. let objectName = {
    properties inside object
    };

  10. The property values inside of the same object can be changed at will later inside the same program, which is not possible with
    values of the type integer, string and boolean.

SECOND PART

  1. String values are immutable and can only access the properties that have been programmed into them by the programming language.

  2. You can use the rest parameter to accept any number of arguments inside a function. Use the rest parameter by writing three dots in front of the last parameter inside a function.

  3. Serialization is used to convert the state of a program or file for saving purposes or to send it.

  4. JSON is a broadly used serialization format used on the web.

  5. In JSON, property names must be surrounded by double quotes. Everything that involves computation is not allowed. It is like a captured moment, a photograph.

1 Like
Questions
  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?
  2. What variable type can be used in order to solve the problem of storing multiple values?
  3. What are properties in Javascript?
  4. Which values do not have properties?
  5. How can we access properties in a value (two ways)?
  6. What are methods?
  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?
  10. What can you say about the mutability of Javascript objects?

SECOND PART:

  1. Why can’t you add new properties to a string variable?
  2. What are rest parameters?
  3. What is serialisation and what is a use case of serialisation of data?
  4. What is JSON?
  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
  1. He want so have a set of data that he could track, and this is not possible by using single variables.

  2. An array could be used to store multiple values which is what he needs.

  3. A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure.
    There are two kinds of properties:

  • Instance properties hold data that are specific to a given object instance.
  • Static properties hold data that are shared among all object instances.

    A property has a name (a string) and a value (primitive, method, or object reference). Note that when we say that “a property holds an object”, that is shorthand for "a property holds an object reference ". This distinction matters because the original referenced object remains unchanged when you change the property’s value.
  1. The JavaScript exception “null (or undefined) has no properties” occurs when you attempt to access properties of null and undefined. They don’t have any.

  2. There’s two ways to access properties: objectName.propertyName or objectName["propertyName"]

  3. A method is a function which is a property of an object.
    There are two kind of methods:
    Instance Methods which are built-in tasks performed by an object instance, or Static Methods which are tasks that are called directly on an object constructor.

  4. The Object class represents one of JavaScript’s data types. It is used to store various keyed collections and more complex entities. Objects can be created using the Object() constructor or the object initializer / literal syntax.

  5. They collect 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.

  6. Objects are variables too. But objects can contain many values.
    This code assigns many values (Honda, Accord, white) to a variable named car:
    var car = { type: "Honda", model: "Accord", color: "white"};
    The values are written as name:value pairs (name and value separated by a colon).

  7. A mutable object is an object whose state can be modified after it is created. An immutable object is an object whose state cannot be modified after it is created.
    Examples of native JavaScript values that are immutable are numbers and strings.
    Examples of native JavaScript values that are mutable include objects, arrays, functions, classes, sets, and maps.

  8. They are immutable and can’t be changed.

  9. The rest parameter syntax allows us to represent an indefinite number of arguments as an array.

  10. The process whereby an object or data structure is translated into a format suitable for transferral over a network, or storage (e.g. in an array buffer or file format).
    In JavaScript, for example, you can serialize an object to a JSON string by calling the function JSON.stringify().

  11. JSON is a syntax for serializing objects, arrays, numbers, strings, booleans, and null. It is based upon JavaScript syntax but is distinct from it: some JavaScript is not JSON.

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

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 requires storing multiple pieces of information together. While this could be done using strings, parsing strings is more trouble than it’s worth.

(on a side note I worked on a C# project where a novice programmer had decided to encode related data into the names of checkboxes in the User Interface (UI)! :grimacing:

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

Array or Object

3. What are properties in Javascript?

A name-value pair associated with an object

4. Which values do not have properties?

The values null and undefined.

5. How can we access properties in a value (two ways)?
  • Properties are accessed by name via the dot operator- i.e. foo.bar
  • Properties can also be accessed using square bracket notation. This method is required if the property name is not a valid name for a binding like a number. I.e:
    • myArray[1]
    • person["first name"]
  • Using the square bracket notation has the advantage of allowing you to use an expression that evaluates to the name of property like a variable.
6. What are methods?

Values that are functions.

7. What are objects?

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

Problems that require relational data.

9. How do you define an object?

A comma separated list of name-value pairs, wrapped in curly braces. Name value pairs are separated with colons (:). I.e:

let person = {
name: "Bob",
age: 40
}
10. What can you say about the mutability of Javascript objects?

Mutability means the property values of an object can change. On a more fundamental level this effects how equality is evaluated.

  • 2 objects are equal only if they reference the same instance
  • 2 separate object instances with identical property names and values are not equal

SECOND PART:

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

Because strings are not objects and are immutable.

2. What are rest parameters?

A special parameter which represents any additional supplied parameters as an array (the “rest” of the parameters). The rest param must be the last parameter listed and is prefixed with ....

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

The process of converting data into a format more suitable for sending or storing somewhere- i.e. for sending in an http request.

5. What is JSON?

Java Script Object Notation

6. What are the differences between JSON and the way programmers write objects in plain Javascript?
  • Property names are double quoted
  • Values cannot be expressions or functions
  • No comments
2 Likes

Data Structures (Arrays and Objects) - Reading Assignment:

  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? Answer: Jaques needed to collect a list of seemingly unrelated data in order to analyze it for commonalities and determine the cause of his nighttime transformation.
  2. What variable type can be used in order to solve the problem of storing multiple values? Answer: A sequence of value types can be stored in a JS notation called an Array.
  3. What are properties in Javascript? Answer: “Properties are the values associated with a JavaScript object. A JS object is a collection of unordered properties. Properties can usually be changed, added, and deleted, but some are read only.” -( w3schools.com )
  4. Which values do not have properties? Answer: null, undefined
  5. How can we access properties in a value (two ways)? Answer: With a dot - .x and with a square bracket [x]
  6. What are methods? Answer: Methods are actions that can be performed on objects. They have properties that contain functions and relate to the method of value they belong to such as toUpperCase is a method of a string . There are also push and pop methods.
  7. What are objects? Answer: Objects are variables which are also containers for data values and can contain many values.
  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)? Answer: Objects allow mutability of normally fixed values . Properties can be changed modifying a single object value to have a different content at different times.
  9. How do you define an object? Answer: With let, i.e. let object1= {value: 5};

let object2 = {value: 11};

  1. What can you say about the mutability of Javascript objects? While strings, Booleans, and numbers are immutable, Objects use bindings to connect and keep track of changing values.

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 to change numbers, strings, and Boolean values.
  2. What are rest parameters? When a Math.max function is called, the rest parameter is bound to an array containing all further arguments.
  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 a way of coding an object or data structure via JSON format into a transferable for for storage or to a network.
  5. What is JSON? JavaScript Object Notation
    6.What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON allows only simple data expressions with names in double quotes and cannot do actual computation such as function calls, and bindings. It also does not allow comments. JavaScript gives the functions JSON.stringify and JSON.parse to convert data to and from this format.
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? Variable types such as strings and integers are only able to hold a single type of data. What Jaques needs is a data structure that is capable of storing multiple values so that he can keep all of the information he collects organized.

2. What variable type can be used in order to solve the problem of storing multiple values? An array is a data type that can be used to store a sequence of values.

3. What are properties in Javascript? A property is the association between an object key and its value, similar to how a variable is the association between a name 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.

6. What are methods? JavaScript methods are actions that can be performed on objects.

7. What are objects? JavaScript objects are containers for named values called properties and methods.

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 are special as they are able to hold as many different datatypes as we need.

9. How do you define an object? A JavaScript object is designed using an object literal:
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

10. What can you say about the mutability of Javascript objects? The mutability of Javascript objects means that the values they contain can be changed. This is different from the other data types such as strings, numbers, and Booleans, which are all immutable.

1. Why can’t you add new properties to a string variable? A string is not an object but a primitive data type. Therefore, it is immutable.

2. What are rest parameters? Rest parameters are an improved way to handle function parameters, because they allow users to represent an indefinite number of arguments as an array.

3. 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. Serialization can be used to translate an object state into bytes so that it can be sent over a network or stored on a hard drive.

4. What is JSON? JSON stands for JavaScript Object Notation. It is a lightweight format for storing and transporting data and is often used when data is sent from a server to a web page.

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.

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?
    Storing multiple values and datatypes are required to organise information properly, when variables are able to hold only single type of data like strings or integers

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

  3. What are properties in Javascript?
    Characteristics of the values

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

  5. How can we access properties in a value (two ways)?
    with a dot and binding name “array.length” or square brackets with an expression array[“length”]

  6. What are methods?
    Methods are properties that contain function values and work only on the value
    they belong to

  7. What are objects?
    Objects are data structures that contain 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 store as many different datatypes as needed

  9. How do you define an object?
    Braces are used to create objects. Properties inside the braces are separated by commas. Each property is named, follow by a colon and a value.

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

  11. Why can’t you add new properties to a string variable?
    Because it is immutable, but it has built in properties like slice or indexOf

  12. What are rest parameters?
    Rest parameters allow functions to allow any number of arguments

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

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

  15. What is JSON?
    JavaScript Object Notation is a serialisation format widely used for data storage and communication on the Web

  16. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON only allow simple values expression like strings, numbers, arrays and booleans. So no function calls, bindings, or anything that involves actual computation. Property names should be surrounded in double quotes and no comments are allowed.

1 Like

FIRST PART

  1. The requirement of storing a sequence of values, which is done through an array. Values and strings can only point to a single value/string.
  2. Arrays.
  3. Properties are attributes relating to values. All values, except for null and undefined, have some form of properties.
  4. Null and undefined.
  5. either with . or [] e.g. value.property or value[“property”]
  6. Properties which contain a function.
  7. Objects are a collection of properties, capable of storing various data.
  8. Objects are mutable, allowing a piece of code to change the value of a property within the object.
  9. The object is enclosed with curly brackets {} and each property is defined with colon and seperated with a coma.
  10. The values of properties within an object can be modified through code.

SECOND PART:

  1. Unlike objects, string variables are immutable and hence don’t allow this.
  2. Rest parameters take the full array of arguments in a function and this can be done by using three dots …
  3. (Feel free to skip the sub-chapter of Math object and Destructing)
  4. Serialization turn any object into a flat string. This is useful when storing data or sending it over a network.
  5. JSON is a serilalization format widely used in data storage and communication on the web.
  6. Property names in JSON need to be encased in “”
1 Like