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?
This chapter introduces how Javascript can apply multiple data types that can not be solved by single data types such as strings and integers.

2. What variable type can be used in order to solve the problem of storing multiple values?
An array variable type, which is an ordered collection of data, can solve the problem.

3. What are properties in Javascript?
Properties are the values associated with an object.

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

5. How can we access properties in a value (two ways)?
You can access properties in a value with a dot (.) or square bracket ([]).

6. What are methods?
Methods are properties containing a function definition such as .toUpperCase

7. What are objects?
Objects are 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)?
Objects can solve more complex data such as correlations of multiple variables.

9. How do you define an object?
An object can be defined using curly braces {}.

10. What can you say about the mutability of Javascript objects?
Mutability means that you can change the values. Only objects and arrays are mutable in Javascript. Numbers, strings, and boolean are immutable values.

SECOND PART
1. Why can’t you add new properties to a string variable?
Because string is not an object which is a mutable variable. It is one of the primitive types which are immutable valuables.

2. What are rest parameters?
Rest parameters syntax allow us to represent an indefinite number of arguments as an array.

3. (Feel free to skip the sub-chapter of Math object and Destructing)
I read it but it was difficult to follow…

4. What is serialisation and what is a use case of serialisation of data?
Serialization is to convert data into a flat description. JSON is a use case of serialization of data that is used as data storage and commucation format on the Web.

5. What is JSON?
JSON (JavaScript Object Notation) is a popular serialization format. It is used as data format for data inter change on the Web.

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 also not allowed.

1 Like
  1. Storing sequences of values.
  2. Array
  3. Properties are values inside an object
  4. Null and undefined
  5. With a dot and square brackets
  6. Properties that contain functions
  7. Collections of properties
  8. When you want to group data together and the itself is unordered and of varying data types then an object is preferred.
  9. Using braces as an expression
  10. You can change their properties, causing a single object value to have different content at different times.

Second Part:

  1. Strings are immutable
  2. Allows us to represent any number of arguments as an array
  3. Serialization is the conversion of data into a flat description, which is useful for saving and sending data.
  4. JavaScript Object Notation
  5. JSON requires all property names to be surrounded by double quotes and only data expressions are allowed meaning no comments, function calls, binds or anything that involves actual computation are not allowed.
1 Like
  1. The problem that was introduced in this sub-chapter was storing multiple values of different data type in a single binding.
  2. Arrays and objects can store multiple values.
  3. Properties are expressions that allow us to access a characteristic of a value that is associated with.
  4. Both null and undefined don’t have properties.
  5. We can access properties in a value by using square brackets someValue["propertyName"] or with a dot someValue.propertyName. If property name starts with a number or contains a whitespace character we have to use square brackets.
  6. Methods are special kind of properties that hold function values.
  7. Objects are useful data structures that hold arbitrary collections of properties.
  8. Objects allow us to store multiple values of different data types and they also provide some structure to our data.
  9. We can declare an object as any other binding and define actual value between curly braces as pairs of a property name and its value. Example:
var object1 = {
  firstProperty: "first value",
  secondProperty: 123,
  thirdProperty: [4, 5, 6, 7]
};
  1. Unlike other kinds of values object’s properties can be modified.

Second part:

  1. String value type has some build-in properties but adding new one or changing them would have very limited use case and would give us new way to mess up our code. So strings are immutable and their properties cannot be changed.
  2. Rest parameters allow us to define a function which can accept any number of of arguments by bounding them into an array.
  3. Serialization converts data from bits in memory into flat description of data, that can be easily stored and send to another machine.
  4. JSON stands for JavaScript Object Notation and it is popular serialization format. It is commonly used for communication and data storage.
  5. In JSON, properties have to be surrounded by double quotes and there can’t be any functions, comments, bindings - only simple data (“objects” and arrays are allowed).
1 Like

FIRST PART:

  1. In this chapter Jacques is keeping a daily log of everything he does on a given day and if he has changed for or not. It means he wants to store data that is more complex then simple data structures like values, strings, or Booleans.

  2. To store multiple values we can use object type variable.

  3. Properties in Javascript are different properties of some value, like for example the length of a string.

  4. Values that are null or undefined do not have properties.

  5. To access values we can use the square brackets, like for example value[i] and the second option would be to access it with dot(.), like for example value.length.

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

  7. Objects are collections of complex, randomly chosen properties.

  8. We can store multiple different properties and its values inside a single variable. We can combine and store all different values (string, number, boolean) and also arrays inside one variable.

  9. Objects are defined inside {} brackets. We can bind a variable with a {}. Like for example: let a = {today: 1, tomorrow: 2, work : “i went to work today.”}

  10. You can change objects properties, causing a single object value to have different content at different times.

SECOND PART:

  1. You cant add new properties to a string variable because it is immutable and cannot be changed.

  2. Rest paramaters are bound to an array and contain all the elements of that array.

  3. Serialization means that data is translated into flat description. It is used when we want to store data and send it across the network.

  4. JSON stands for Javascript object notation. It is a type of serialization format to store data and format of communication on the web.

  5. JSON have few restriction how the data is stored. When talking about arrays and objects, all property names have to be sorrounded by double quotes and only simple data expressions are allowed, meaning that there are no functions calls, no bindings and anything that involves computation is not allowed.

1 Like

PART ONE
1.The problem facing by our friend is, he doesn’t has a data base storage to store all the information is a organised way. Variables such as strings and integers are only able to hold a single value. What he needs is a data storage variable.
2.Arrays can be use
3.Properties are the foundation of an element, like what they possess. Most Java script values have properties. Basically, they are used to defined the characteristics of the values in the data structure such as length.
4.Null and undefined
5. Two main ways to access the properties of the elements in JavaScript is the bracket [] and dot .
6.Methods are properties that hold function values
7.Objects express bracket grouped elements of an array to a Boolean value such as true or false.
8.Objects are able to hold different data types together such as a string and a integer
9.let objectA = {a: 1, b: 2};
10.Mutability is general is the tendency to change, so likewise in Java script the value that is contain in a variable is able to change.

Part Two
1.String is immutable because it is in a closed system.
2.Adding three dots into the function and a variable after will represent the rest of the element contain inside.
3.Serialize is to convert data stored in the memory into a flat description.
4. JSON stands for Java script Object Orientation. Which is beneficial for storing data and transporting data. It is also easy to understand
5.Properties should be written in double quotes and comments is not allow.

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 problem of values that have primitive value and cannot be changed.

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

  3. What are properties in Javascript?
    Functions and variables belonging to a named value.

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

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

  • value.x ( .x is a valid variable name - the properties of value x are fetched).
  • value[x] (x is evaluated and uses the result as a property name).
  1. What are methods?
    These are actions that can be performed on objects.

  2. What are objects?
    They make it possible to group many values. They are collections of named values.

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

  4. How do you define an object?
    With an object literal e.g. var student = {firstName: “Anne”, lastName: “Marie”, age: 25, eyeColor: “brown”};

  5. What can you say about the mutability of Javascript objects?
    Object values can be modified after they are created.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    It can’t be modified. It is immutable. Values of type string, number, and Boolean are not objects.

  2. What are rest parameters?
    The rest parameter syntax allows the inclusion of an indefinite number of arguments as an array.

  3. (Feel free to skip the sub-chapter of Math object and Destructing)
    Math object makes it possible to perform mathematical tasks on numbers.
    Destructuring is a way of extracting multiple values from data stored in objects and Arrays.

  4. What is serialisation and what is a use case of serialisation of data?
    In serialisation data is converted into a flat description to make storage and data transportation easier.

  5. What is JSON?
    It is a serialisation format that is widely used for
    data storage and communication on the Web in different programming languages.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    Although JSON is language-independent it is 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 either.

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?

In this scenario Jacques needs to keep track of many related and unrelated things so that he can analyze the evidence and figure out what is causing his lycanthropy. Variables and strings might only be able to keep track of a singular thing but he needs to keep track of many.

  1. What variable type can be used in order to solve the problem of storing multiple values?
    One of the variables we we have learned already that could help with keeping track of this data is arrays.

  2. What are properties in Javascript?

Properties are data and information about specific arrays, strings, integers, and variables. This could be something as simple as how many characters are in a string, the index number of a specific variable within an array, the value of the number(for example whether it is higher or lower to another number)

  1. Which values do not have properties?

Null and undefined

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

  2. What are methods?

a property that contains a function is considered a method.

  1. What are objects?

Objects are the collection of properties of different values.

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

The other methods allow you to store values but with Objects you can do more than just store- you can organize and modify values and properties.

  1. How do you define an object?

You would use braces as an expression and separate the values with a comma.

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

With variables like strings and integers you can’t change their properties that makes them immutable
With Objects though, you actually can change the properties making them mutable.

SECOND PART:

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

A string is not an object so it is immutable and the properties can not be changed, removed, or new ones added.

  1. What are rest parameters?

A function that can have an unlimited number of arguments.

  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?

data that has been serialized means that it has been converted into a simple form that can be sent to another machine that is running the code.

  1. What is JSON?

a popular form of serialization that is mainly used for data storage and web communication.

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

One of the major differences is that all property names have to be surrounded by double quotes, which is why it’s probably a smart idea to get in the habit of doing this even when writing in plain javascript. The biggest drawback is the fact that you can not make comments on JSON.

1 Like
  • 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? What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?

Storing values in a bundge. Objects and arrays can be used to group multiple values into a single value.

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

Objects and arrays.

What are properties in Javascript?

Expressions that access a property of some value.

Which values do not have properties?

null and undefined

  • How can we access properties in a value (two ways)?
  1. value.x1
  2. value[x]
  • What are methods?

Properties that contain functions.

  • What are objects?

Arbitrary collection of properties.

  • What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?

Data can be grouped to objects thus analyzed in relation to each other.

  • How do you define an object?

Using braces as an expression:

let day1 = {
squirrel: false,
events: ["work", "touched tree", "pizza", "running"]
};

To check on the defined object:

console.log(day1.squirrel); 
// → false 
console.log(day1.wolf);
// → undefined
day1.wolf = false; console.log(day1.wolf);
// → false
  • What can you say about the mutability of Javascript objects?

Mutability – The properties of javascript properties can be changed, causing a single object value to have different content at different times.

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

Immutability…

What are rest parameters?

By adding three dots before the function’s last parameter the written functinos can accept any number of arguments.

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

Data is converted into a flat description. Data can be saved off the computers memory to be saved and send.

What is JSON?

A serialization format that can be used as a data storage and communication format on the web.

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

  • All property names have to be surrounded by double quotes
  • No function calls, bindings, or anything that involves actual computation
  • No comments are allowed
  • Only data expressions are allowed
1 Like

1)What problems does this chapter introduce that cannot be solved by variable types such as strings?

The chapter deals with Objects, Arrays, and methods. With an array you can assign several values for one variable.

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

With an array you can assign several values for one variable.

3)What are properties in Javascript?

Properties denote a character of a value like the length of a string or the maximum value in an array.

  1. What values do not have properties?

The only values that does not have properties are the null and undefined.

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

You can access properties using either 1) brackets, or 2) dot

  1. What are methods?

A method is a way to access properties like .bind, .Properties that contain functions are generally called methods of the value they belong to: toUpperCase is a method of string.

7)What are Objects?

Objects are name value pairs

8)What problem do objects solve that cannot be solved with other value types we’ve learned so far such as integers, strings, arrays, booleans etc?

An object can hold any value, a function or another object so you are able to build more complex data structures.

  1. How do you define an object?

An object is a name/value pair. It can have a name or be anonymous and it will have a value like a number, string, array, booleans or another object.

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

They are changeable.

Second part

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

Javascript values are immutable. They cannot be changed

2)What are rest parameters?

The rest parameter is used when you have unlimited number of arguments by using the dot dot dot before the last number …number

3)N/A

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

When data is converted into a flat description it is call serialized. It can then be transported across the web.

  1. What is JSON?

JSON is a type of serialized data used on the web and in Javascript and other languages.

  1. What is the difference between JSON and the way programmers write objects in plain Javascipt?

In JSON the name is also in double quotes just as the value when you are converting a string. No computations. No function calls or bindings and no comments.

1 Like

PART 1

  1. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    A: The variable types we have worked with so far such as strings and integers are limited–they can only hold one type of data (i.e., they are simple). However, sometimes we need to build more complex structures and this is where objects come into play.

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

  3. What are properties in Javascript?
    A: Properties are the values associated with a JavaScript object.

  4. Which values do not have properties?
    A: Null and Undefined.

  5. How can we access properties in a value (two ways)?
    A: With a dot and with square brackets.

  6. What are methods?
    A: A method is a function which is a property of an object.

  7. What are objects?
    A: An object is a collection of properties. They can be constructed using braces, which contain a list of names and values, separated by a comma.

  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: They are more complex and can therefore hold more information. Whereas an array, for example, can hold only the names of a car manufacturer, an object can hold additional info (e.g., year, make, etc.). In other words, they can hold multiple data types.

  9. How do you define an object?
    A: Objects are defined much like other variables, except that one uses braces instead of parentheses and brackets. For example: var car1 = {manufacturer: “Volkswagen”, year: 2005};

  10. What can you say about the mutability of Javascript objects?
    A: Elements within Javascript objects can be changed after they have been defined originally. In this sense they are different from datatypes such as strings, which are not mutable.

PART 2

  1. Why can’t you add new properties to a string variable?
    A: Because they are a string datatype and therefore are not mutable by definition/design.

  2. What are rest parameters?
    A: A rest parameter is denoted by three dots preceding the name of an array. This allows you to, for example, insert all the values of that array into a statement.

  3. What is serialisation and what is a use case of serialisation of data?
    A: Serialisation is converting stored data into a flat description of what that data is. It is useful for when we want to transfer the data to another computer.

  4. What is JSON?
    A: Javascript Object Notation. It is a widely used data storage and communication format on the Web, even in languages other than JavaScript.

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    A: All property names in JSON have to be surrounded by double quotes, and only simple data expressions are allowed—no function calls, bindings, or anything that involves actual computation. Also, comments are not allowed.

1 Like
  1. strings and integers by themselves have no way to organize sequences of data, or the ability to store multiple key:value pairs.
  2. arrays and objects
  3. properties are the key-value pairs that are part of any object. Some properties come built in with the language and others are created and assigned by the developer as a part of his program
  4. Only objects have properties. Primitive data types are not objects and so cannot be given properties, but since technically they are created as part of built in objects in the language, they actually DO have certain properties natively made available to them - with the exception of “undefined” and “null” data types.
  5. with a dot, like str.value or brackets, like str[value]
  6. functions stored as object properties
  7. composite data types capable of containing multiple values grouped together
  8. the ability to group together different data types and the ability to define not only the value but the key for each value
  9. let objectName = {firstname: value, LastName: value};
  10. object values ARE mutable

SECOND PART

  1. Because it is not an object
  2. parameters that use “…” before them to represent a number of items
  3. [SKIPPED]
  4. serialization is basically the action of taking data that is wrapped within the values of an object and converting it into a flat text format. this format is easier to transmit to other places, like over the web from one program to another, where it is (typically) converted back from this serialized format to the object format of the receiving system.
  5. JavaScript Object Notation is a popular serialization format for transmitting data on the web.
  6. they are very similar, but for example all property names in JSON have to be wrapped in double quotes, and JSON data will not include any functions, bindings or any computations or comments - just simple data expressions
1 Like

First part

  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
  • Jacques is going to keep track of everything he does during the day for multiple days. ‘atom’ level variables can not hold this data. A data structure that can hold a collection of data is needed.
  1. What variable type can be used in order to solve the problem of storing multiple values?
  • Array variable.
  1. What are properties in Javascript?
  • You could see them as prebuild functions belonging to values. They allow you to easily retrieve specific property values eg. string.length
  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 with square brackets
  1. What are methods?
  • They are properties that hold function values.
  1. What are objects?
  • They are arbitrary collections of properties i.e. a string and a boolean ‘packaged’ together in 1 object.
  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)?
  • combining different data types in a single data structure.
  1. How do you define an object?
  • by using braces as an expression. Inside the braces, there is a list of properties separated by commas. Each property has a name followed by a colon and a value.
  1. What can you say about the mutability of Javascript objects?
  • If an item is mutable, modifying the copy also modifies the original because they are the same. If it’s immutable, modifying the copy does not affect the original. Object and arrays are mutable.

Second part:

  1. Why can’t you add new properties to a string variable?
  • Because a string is not an object. String properties are immutable and cannot be changed.
  1. What are rest parameters?
  • It’s a parameter that can hold an ‘unlimited’ number of values. It is bound to an array instead of single string, number, … type.
  1. What is serialisation and what is a use case of serialisation of data?
  • It is the process of converting an object’s state to a string from which it can later be restored.
    Use Case: You could run a serialisation string through a hashfunction.
  1. What is JSON?
  • JSON (JavaScript Object Notation) is a lightweight format that is used for data interchanging. XML used to be the preferred format for transmitting data, now it is JSON because it is much more lightweight. JSON is great to serialize data.
  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 expressions are allowed—no function calls, bindings, or
    anything that involves actual computation. Comments are not allowed in
    JSON.
1 Like

Part 1

  1. The problem that was introduced in this chapter was that how Jacques would be able to input a set of data that can store multiple values. Because if he only chooses to use numbers, strings, and booleans it will only hold to a single type of value.

  2. Arrays.

  3. Properties are values or a characteristics of an object in javascript.

  4. null and undefined.

  5. by dot (.) and square brackets [x] .

  6. Methods are properties that contain functions.

  7. Objects are a collection of properties.

  8. Objects allow us to store a grouping in an array with different types of data it can be strings or integers and makes it a single value.

  9. One way to define an object is by binding it to a name and after that you use curly braces and inside of those braces are a list of multiple varying values separated with commas.

  10. Object values are more flexible compare to the values of strings, numbers and booleans, its because object values are mutable it means they are changeable compare to the ones that I mentioned above that aren’t.

Part 2

  1. Because string is not an object, if you try to set new properties on them, it doesn’t actually store those properties. String values are immutable just like number and boolean.

  2. Rest parameters accept any number of arguments it is usually done by putting three dots before the function last parameter.

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

  4. Serialization is where a data is converted into a flat description. The use case is that it can be use when you save a data in a file for later and also when you want to send it to another computer over the network.

  5. JSON is a serialization format which stand for Javascript Object Notation, it is widely used as a data storage and communication format on the Web, even in languages other than JS.

  6. The difference is that in JSON there are few restrictions such as 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, and also comments are not allowed in JSON.

  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 necessity of storing large amounts of data that can not be store in atomic data types like Numbers, Booleans and strings, this introduces the need of developing Data Structures based on this atomic data types.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    Arrays and they are written as a list of values between brackets, separated by commas.

  3. What are properties in Javascript?
    Properties are the values associated with a JavaScript object. A JavaScript object is a collection of unordered properties. Properties can usually be changed, added, and deleted, but some are read only.

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

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

By the property name: car.color = red
By the position within the array like car[2] => would yield “color” which is the name of the property provided this property hold the position number 2 in the data structure of the array “car”.

  1. What are methods?
    JavaScript methods are actions that can be performed on objects. A JavaScript method is a property containing a function definition.

  2. What are objects?
    JavaScript is designed on a simple object-based paradigm. An object is a collection of properties, and a property is an association between a name (or key) and a value. … In addition to objects that are predefined in the browser, you can define your own objects.

  3. 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)?
    The necessity of storing large amounts of data that can not be store in atomic data types like Numbers, Booleans and strings, this introduces the need of developing Data Structures based on this atomic data types.

  4. How do you define an object?
    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 ( {} ):

Var myCar = {

Make: ‘Ford’

Model: ‘Mustang’

Year: 1969

};

  1. What can you say about the mutability of Javascript objects?
    In JavaScript, only objects and arrays are mutable, not primitive values. … A mutable object is an object whose state can be modified after it is created. Immutables are the objects whose state cannot be changed once the object is created. Strings and Numbers are Immutable.

SECOND PART

  1. Why can’t you add new properties to a string variable?
    Values of type string, number, and Boolean are not objects, and though
    the language doesn’t complain if you try to set new properties on them, it
    doesn’t actually store those properties. As mentioned earlier, such values are
    immutable and cannot be changed.

  2. What are rest parameters?
    The rest parameter syntax allows us to represent an indefinite number of arguments as an array.
    A function’s last parameter can be prefixed with ... which will cause all remaining (user supplied) arguments to be placed within a “standard” JavaScript array.
    Only the last parameter can be a “rest parameter”.

  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?
    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() and you can call the function JSON.parse() to convert data from this program.

  5. What is JSON?
    JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa).

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

I gotta be honest, the textbook is overly-complicated for newbs like me. I’m learning some of these concepts much faster by visiting w3schools.com

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 long sequences of values is not easily done with strings. This is where arrays come in handy.

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

3. What are properties in Javascript?
Properties are inherent in JavaScript values that can be accessed using .value or brackerts [ ].

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

5. How can we access properties in a value (two ways)?
By using .value and brackets [ ]

6. What are methods?
Functions that live within properties and act on the value they’re a property of. So confusing!

7. What are objects?
Are used to consolidate multiple values into one value.

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)?
Storing multiple values into one value for ease of use… I think.

9. How do you define an object?
name : value

10. What can you say about the mutability of Javascript objects?
Objects are mutable, meaning they can be changed.

11. Why can’t you add new properties to a string variable?
They’re immutable and cannot be changed. You can try, and JavaScript won’t alert you, but new properties will not stick.

12. What are rest parameters?
This section of the textbook is not clear. However, an online seach returns the following:
The rest parameter syntax allows us to represent an indefinite number of arguments as an array.

13. What is serialisation and what is a use case of serialisation of data?
Serialzation is converting data to text. A use case for this is sending files from one computer to another.

14. What is JSON?
JSON is a text representation of data. It uses human-readable text to store and transmit data objects.

15. What are the differences between JSON and the way programmers write objects in plain Javascript?
I understand they’re both very similar, however, JSON requires that all property names need to be wrapped in double quotes.

  1. We can store and access sequences of values.

  2. Arrays.

  3. Properties are things that describe the object.

  4. Null and Undefined.

  5. Dot and with square brackets. Both value.x and value[x] access a property on value.

  6. Methods are things that an object can do.

  7. Objects are data structures that contain properties and methods.

  8. Objects can hold many different data types.

  9. Values of the type object are arbitrary collections of properties. One way to
    create an object is by using braces as an expression.

  10. You can change objects properties, causing a single
    object value to have different content at different times.

SECOND PART

  1. Because strings are immutable and cannot be changed.

  2. A function accepting any number of arguments.

  3. If we want to save the data in a file or send it to another computer we can serialise the data, which means it’s converted into a flat description.

  4. JSON is a popular serialization format, used as a
    data storage and communication format on the Web.

  5. 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. Store several values
  2. Array
  3. Expressions that access a property of almost all JS values
  4. null and undefined
  5. value.prop or value[prop]
  6. Functions within properties
  7. data structure capable of containing arbitrary collection of properties
  8. they can store many different properties
  9. braces are used to create objects, properties inside are separated by commas, each property have a name with colon and value.
  10. all the values can be changed

second part

  1. because strings are immutable
  2. rest parameters are bound to array which contains all further arguments. This allow function to allow any number of arguments.
  3. it is conversion of data stored in memory into a flat description of what data is.
  4. serialisation format widely used for data storage and communication
  5. only simple expression are allowed in JSON, no computations are allowed
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?

Variable types such as strings and integers are only able to hold a single type of data. What we need is a data structure that is capable of storing multiple values and datatypes.

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

Arrays and Objects.

3. What are properties in Javascript?

Properties define some characteristic about the values in a data structure, such as the length of an array or the index of a value.

4. Which values do not have properties?

Null and undefined.

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

Properties in a value can be accessed using a dot and the literal name of the property. e.g. array.length
They can also be accessed using square brackets, with the expression between the brackets being evaluated to get the property name. e.g. array[“length”] or array[0].

6. What are methods?

Methods are properties that hold function values.

7. What are objects?

Objects are data structures that are capable of containing an arbitrary 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 are special as they are able to hold as many different datatypes in the same object.

9. How do you define an object?

Objects are defined as any other variable, with the value being a list contained within braces.

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

The mutability of Javascript objects means that the values they contained can be changed. This is different to other datatypes such as strings, which will always keep the same value it was defined with.

PART 2

1. Why can’t you add new properties to a string variable?
Unlike objects, strings are immutable and cannot be changed. .

2. What are rest parameters?

Rest parameters are abstract parameters used within functions that accept any number of arguments.
This allows functions to allow any number of arguments. To add a rest parameter use three dots before the function’s last parameter. For example:

let numbers = [5, 1, 7];
console.log(max(…numbers));
// → 7

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

5. What is JSON?

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

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

Only simple expressions are allowed in JSON. There are no functions, bindings, comments, or computations.

  1. The problem is that we have multiple data for one variable. Using arrays we are able to have more than one assigned “value” to a variable.
  2. Objects filled with arrays.
  3. Properties are the characteristics of some value. I.e. Console.log(“three”.length) //-> 3
  4. null, undefined
  5. by using “.value” I.e. “.length” or using “[]” after the variable name i.e. console.log(data[2])
  6. A property of a value that contains a function.
  7. An object is a user created value type of collection of properties. That sounds like a mouthful of English.
  8. Objects allow us to have multiple properties (that the user creates) within one value. Therefore it is faster when calling upon those properties and we can have multiple arrays within that one value. (arrays within arrays).
  9. Objects are value types that can have multiple different property types within two curly braces.
  10. We are able to change the values of the properties of objects, which makes them mutable. Strings, booleans, and numbers are value types in which their properties are immutable.
    PART 2
  11. Why can’t you add new properties to string? Because they have intrinsic property values and if you wanted to change those, it would mean changing the string itself.
  12. What are rest parameters? Rest parameters are “…”, this will compute all of the arguments that are bound to an array “…arrayWeWantToInclude”
  13. I liked this chapter. LOL what happened to the Weresquirrel?! The math is simple if you have had some statistics before.
  14. what is serialization and its use case? Serialization is when you flatten data and make it a lot easier to read by other computers. it saves memory space, instead of having arrays within arrays you flatten the data to make it simple.
  15. What is JSON? It is a popular standard format of serializating data.
  16. What are the differences btwn JSON and the way programmers write objects in plain javascript? All property names have to be surrounded by double quotes in JSON and only simple data expressions are allowed, which means no function calls, bindings, or anythings that involves computation. No comments are allowed in JSON either.
1 Like

Part 1:

  1. Keeping a daily log that would potentially contain data of differing types, for example string (descriptions of events) and boolean (whether or not he turned into a squirrel).
  2. An object.
  3. Properties are values associated with a JavaScript object.
  4. null and undefined.
  5. You can access properties with a dot, or with square brackets.
  6. Methods are properties that contain functions.
  7. Objects are arbitrary collections of properties.
  8. They can store multiple variable types.
  9. You can create an object by using braces as an expression, inside of which is a list of properties separated by commas.
  10. Objects are mutable, meaning that you can change their properties, causing a single object value to have different content at different times.

Part 2:

  1. You cannot add new properties because they are not objects, and are immutable.
  2. Rest parameters allow you to “spread” out an array into a function call.
  3. Skipped
  4. To serialize data (which is what JSON does), you convert it into a flat description. It allows you the ability to send files without having to send your entire computer memory.
  5. JSON stands for JavaScript Object Notation, and is used as a data storage and communication format.
  6. In JSON, all property names need to be surrounded in double quotes, and function calls, bindings and actual computations are not allowed.Also, there are no comments in JSON.
1 Like