Data Structures (Arrays and Objects) - Reading Assignment

First part:

  1. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    We need data structures to store multiple values.

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

  3. What are properties in Javascript?
    They are the values associated with a JavaScript object.

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

  5. How can we access properties in a value (two ways)?
    With a dot or square brackets (value.x or value[x])

  6. What are methods?
    Properties that hold function values.

  7. What are objects?
    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)?
    They can store different types of values.

  9. How do you define an object?
    Using braces as an expression.

  10. What can you say about the mutability of Javascript objects?
    You can modify values inside an object.

Second part:

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

  2. What are rest parameters?
    They allow us to represent any number of arguments as an array.

  3. What is serialisation and what is a use case of serialisation of data?
    Data is converted in to a flat description.

  4. What is JSON?
    JavaScript Object Notation. It is used as data storage and communication format on the Web.

  5. 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. Also comments are not allowed in JSON.

1 Like
  1. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    Sometimes more complex data structures are needed, made from multiple variables of various types.
  2. What variable type can be used in order to solve the problem of storing multiple values?
    Arrays
  3. What are properties in Javascript?
    Variables and functions that belong to another variable
  4. Which values do not have properties?
    null and undefined
  5. How can we access properties in a value (two ways)?
    Variable name, followed by property name, using the dot; or followed by square brackets in which case the expression between the brackets is evaluated and passed as the property name
  6. What are methods?
    Functions associated to variables
  7. What are objects?
    Collections of property 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)?
  9. How do you define an object?
    Like a normal variable followed by = {}; with methods and properties between the braces.
  10. What can you say about the mutability of Javascript objects?
    Object properties are mutable

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Values of type string, number, and Boolean are immutable
  2. What are rest parameters?
    Parameters with an undefined number of arguments that are stored in an array and passed to the function
  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?
    Converting the data into a flat description, useful when storing data on a physical support.
  5. What is JSON?
    A popular serialization format
  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    No function calls, bindings, or anything that involves actual computation allowed in JSoN, also no comments
2 Likes
  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 variable type is needed that can store multiple values and make them easy to access.

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

  3. What are properties in Javascript?
    They are characteristics of values in a data structure.

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

  5. How can we access properties in a value (two ways)?
    The two ways are with a dot and with square brackets. Value.x fetches the property of value"x", value [x] ties to evaluate the expression x anuses the result, converted to a string, as the property name.

  6. What are methods?
    They are properties that hold function values

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

  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    They solve the problem to store more complex data types.

  9. How do you define an object?
    Insert it in curly brackets.

  10. What can you say about the mutability of Javascript objects?
    Objects are mutable as their values can be modified

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    It is not an object, it is immutable and cannot be changed.

  2. What are rest parameters?
    It 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 converted into a flat description. If you want to save date in a file and later send it to a another computer over the network.

  5. What is JSON?
    JavaScript Object Notation. 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?
    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?
    problems where we need more complex data structures with multiple values or types of values

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

  3. What are properties in Javascript?
    a property is a value that is related to a data structure and describes a specific feature of the data

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

  5. How can we access properties in a value (two ways)?
    the most common way is to acces them with a dot followed by the literal name of the property, another way is to write the name of the property inside square brackets after the name of the value

  6. What are methods?
    these are functions that can be called like a property

  7. What are objects?
    objects are a collection of structured data

  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    objects solve many problems becasue they create a way to structure data in such a way that it’s easy to access

  9. How do you define an object?
    name of the object followed by “=” followed by curly braces {“data values separated by commas inside curly braces”}

  10. What can you say about the mutability of Javascript objects?
    in Javascript object properties can be changed, meaning that objects are mutable structures where as values such as Boolean or string can not be changed

Second part:

  1. Why can’t you add new properties to a string variable?
    because string values are inmutable

  2. What are rest parameters?
    it’s a way to tell a function to not care about how many arguments it is given

  3. What is serialisation and what is a use case of serialisation of data?
    it’s a way to convert the data to a simple description of it and it’s mainly used for storage and communication

  4. What is JSON?
    JavaScript Object Notation is javascript’s way of serializing data

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON only takes in simple data and doesn’t even accept comments, on the other hand objects can accept code, bindings and comments

2 Likes
  1. More scientific approach
    Keep a daily log of everything he does including the changes made
    This chapter introduces the concept of data structure to store a set of information which cannot be achieved by strings or integers.

  2. Arrays

  3. Values associated with Javascript object are called Javascript properties.

  4. Null and Undefined

  5. ‘.’ or ‘[]’ . For example, value.x or value[x]

  6. A JavaScript method is a property containing a function definition.

  7. JavaScript objects are containers for named values called properties or methods.

  8. Objects can store values of different types such as integers, booleans, strings, arrays etc.

  9. Braces are used to create objects. Properties inside the braces are separated by commas. Each property is named, followed by a colon and a value.

  10. Their properties can be changed causing a single object value to have different content at different times.

SECOND PART:

  1. Though the language doesn’t complain if you try to set new properties on them, it
    doesn’t actually store those properties.

  2. Rest parameters accept any number of arguments. Rest parameters are bound to an array containing all additional arguments given to a function.

  3. Objects and arrays are stored in the computer’s memory as sequences of bits holding the addresses. Therefore there could be a situation where you send over your entire
    computer memory along with the address of the value you’re interested in, which may not be the best practice. In this case, we will have to serialise the data ie convert it into flat description.

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

  5. JSON looks the almost the same as plain JavaScript but with the following restrinctions:
    All property names must be surrounded by double quotes, only simple data expressions are allowed.
    No function calls
    No bindings
    Nothing that involves actual computation
    No comments are allowed

1 Like

What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
It introduces the problem that something can exist in two different forms, in this case a human and a squirrel.

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

What are properties in Javascript?
They are the attributes which a varible has e.g. length when referring to a string.

Which values do not have properties?
null and undefined

How can we access properties in a value (two ways)?
either with the dot notation or with square brackets

What are methods?
They are functions embedded or native to the variable type that can be used to interact with the data held in the variable

What are objects?
Arbitrary collections of properties

What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
It solves the problem when you want to group together different types of value which all refer to a specific instance of something

How do you define an object?
It is created with curly brackets {}, then every value is given a name and its value separated by a colon : and ended with a comma unless it is the last value.

What can you say about the mutability of Javascript objects?
They are mutable as the values inside them can be changed. Two objects instances cannot be compared as equal even if they contain exactly the same values. However two references to the same object can be compared as equal since they are pointing to the same object instance.

Why can’t you add new properties to a string variable?
They are not objects and the values they have are immutable

What are rest parameters?
They are parameters which result in an array being passed. In effect this means the numbers of parameters is not exactly defined since the array can expand to contain many values.

What is serialization and what is a use case of serialization of data?
It is the process of converting data into its actual digital representation as opposed to having it contain addresses to where the data resides. The main use case for this is to allow data to be sent over a network from one computer to another so that it can be reassembled without the need to refer to memory addresses.

What is JSON?
It is a popular data serialization format which resembles the way in which Javascript objects and arrays are written.

What are the differences between JSON and the way programmers write objects in plain Javascript?
property names have to be surrounded by double quotes, only simple data expressions are allowed, no function calls, nothing involving actual computation and no comments.

3 Likes
  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 case we need to store in an organized way different kind of data and we need to be able to update and modify the data to our likes, this is not possible using just numbers, booleans or strings since they allow just one kind of data and they cant be grouped or organized in a structure;
    so the problems here is group, modify data and organize it in a structure to store all the informations for later revision.

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

  3. What are properties in Javascript?
    Properties are all kind of different characteristics of a value that we can access with small expressions.

  4. Which values do not have properties?
    null and undefined are the only two values to have no properties and will return error on a try to access them.

  5. How can we access properties in a value (two ways)?
    we can use the dot notation, using the literal name of the property or the square brakets, using the result of an expression to make a string as the property name.

  6. What are methods?
    Methods of the values are properties that contain functions.

  7. What are objects?
    An object is a variable type used to group different kind of values or 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 create this arbitrary collections of values that we can update, modify and organize in a structure

  9. How do you define an object?
    An object is defined calling a variable name, the name we choose for the object, the equal operator and curly braces. Inside the braces there is a series of properties separated by commas, each property has a name, followed by a colon and the value of it.

  10. What can you say about the mutability of Javascript objects?
    Number, strings and booleans in Javascript are immutable, is not possible change this type of value, they just can be used to derive new values or combined; objects are different in the sense they can be modified at their properties causing the value of the same object to be different in different times.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Once is created that string variable is just gonna stay like is been created, if we want to have a different value we gonna have to create another variable that is gonna hold this new value, no matter how similar to the previus one.

  2. What are rest parameters?
    the rest parameter is bound to an array containing all further arguments subsequent to the last parameter of the function. Is a way to make a function accept any number of arguments.

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

  4. What is serialisation and what is a use case of serialisation of data?
    Serialize data is a process that convert all the memory allocation and sequences of bits that our data is made from, into a flat description that can be easily sent and shared.

  5. What is JSON?
    there are different serialization formats, one of the most popular is JSON (JavaScriptObjectNotation).

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON is pretty similar but:
    -all property names need to be sorrounded by double quotes
    -expressions or computations are not allowed
    -comments are not allowed

3 Likes

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?
Data structures that can store multiple values and keep the information organised.

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

What are properties in Javascript?
Most JS values have properties. The properties defines for example the length of an array.

Which values do not have properties?
Null and undefined

How can we access properties in a value (two ways)?
value.x or value[x]

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

What are objects?
Objects are collections of properties, where you can store different kinds of values.

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 data types as we need.

How do you define an object?
Objects are defined like any other variable where the value is a list contained within braces.

What can you say about the mutability of JavaScript objects?
The mutability of JavaScript means that the values of an object can be changed. That is different from for example. strings or variables which will always keep the same value you define them with.

SECOND PART:

Why can’t you add new properties to a string variable?
Values of type string, number and boolean are not objects. Such values are immutable and cannot be changed.

What are rest parameters?
These are denoted by a function’s last parameter with 3 dots before its name and are useful for functions that accept any number of arguments. When the function is called, the rest parameter is bound to an array containing all further arguments.

What is JSON?
JavaScript Object Notation, and is widely used as a data storage and communication format on the web.

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

1 Like

PART ONE ANSWRES:

This chapter introduces the problem of building an everyday log for Jacques. He needs a log of his daily activities stored in the way that for every day are stored many activities like for example swimming, work, what he eats and a boolean value representing if he had changed in to a squirrel. To build that data structure we need variable that can hold more than one value.

To store multiple values we could use arrays but if we want a boolean value in our data structure we need to use objects.

Properties are additional information of values like for example length of string.

Only null and undefined values doesn’t have properties.

We can access properties of value by a dot like myString.length or by square brackets like myString[“length”].

Methods are value’s properties that contain a function. For example toUpperCase for strings or push() for arrays.

Objects are containers for storing many types of values with their properties and methods.

The problem of storing many strings and boolean value in one daily entry.

I can define object Piotr like this:

let Piotr = {
isHandsome: true,
age: 39,
height: 180,
properities: ["hard working", "eloquent", "nice"]
};

:crazy_face:

Objects in JavaScript are not immutable. We can manipulate on object’s data.

PART TWO ANSWERS:

Because string variables are immutable.

Rest parameters allows us to build functions that accept random number of parameters.

Serialization of data is getting it from program’s memory so we can write or send it in the way that it can be stored to memory again.

JSON is a serialization format (Java Script Object Nation) used in JS and other languages.

In JSON only double quotes are allowed and we can’t use expressions or comments - only objects and arrays.

1 Like

Part one

  1. This chapter introduces the concept that that data need to be stored in an organized way. Variable types such as strings or integers hold an unique value. These values need to be grouped together in more complex structures, and this is what data structures such as objects or arrays do. This way, Jacques can organize efficiently his daily log by grouping and arranging data and understands better what triggers the transformation.

  2. An array.

  3. Properties are the values associated with an object. A property of an object can be explained as a variable that is attached to the object.

  4. null and undefined.

  5. We access them:
    a. with a dot: value.x;
    b. with square brackets: value[x].

  6. Methods are properties of an object that hold function values.

  7. Objects are containers for values such as properties or methods.

  8. They provide ways to group several values into a single value.

  9. By using curly braces as an expression. Inside the braces, there is a list of properties separated by commas.

  10. Unlike the type of values such as numbers, strings and Booleans which are immutable , objects are mutable , they can be modified, their properties can be changed.

Part two

  1. Strings are not objects. Once they are created, they are immutable and cannot be changed. We only can access built-in properties to strings but cannot store new ones.

  2. Rest parameters allows us to represent an indefinite number of arguments as an array. A function’s last parameter can be represented with ... which will cause all remaining arguments to be placed within an array. Only the last parameter can be a ‘rest parameter’.

  3. (Skipped)

  4. JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for people to read and write and for machines to parse and generate. It is derived from JavaScript and is a popular data serialization format (serializing data means converting them into a flat description). JSON is widely used as a data storage and communication format on the web, even in languages other that JavaScript.

  5. In JSON, only simple data expressions are allowed. For instance, expressions that involve computation or comments are not accepted. All property names need to be surrounded with double quotes. With JSON, data are simplified to be easier to read and use.

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 data structure to store information about jacques transformation.

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

  3. What are properties in Javascript?
    A properti can be a lenght of a value or a color of a value.

  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 with square brackets.

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

  7. What are objects?
    Objects are containers for named values called properties or 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)?

  9. How do you define an object?
    Objects may be defined as an unordered collection of related data, of primitive or reference types, in the form of “key: value” pairs. These keys can be variables or functions and are called properties and methods, respectively, in the context of an object .

  10. What can you say about the mutability of Javascript objects?
    A mutable object is an object whose state can be modified after it is created

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

  12. What are rest parameters?
    Rest parameter is an improved way to handle function parameter , allowing us to more easily handle various input as parameters in a function.

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

  14. What is serialisation and what is a use case of serialisation of data?
    Serialization means data is converted into a flat description. A popular serialization format is called JSON. The most common use of serialization is when you need to move an object across process, machine, or, more precisely, AppDomain boundaries.

  15. What is JSON?
    JSON is a popular serialization format

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

2 Likes
  • Data Structures: Objects and Arrays
  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 having a single binding for multiple associated values

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

  3. What are properties in Javascript?: They are field/components of a complex value

  4. Which values do not have properties?: values of type null or undefined

  5. How can we access properties in a value (two ways)?: using the dot operator or an expression inside square brackets

  6. What are methods?: They are function/callable properties

  7. What are objects?: Collections of properties, not necessarily of the same type

  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)?: Associating values of different types and accessing them with non-numeric keys/indexes

  9. How do you define an object?: Binding to an expression enclosed by braces

  10. What can you say about the mutability of Javascript objects?: One may add, remove and modify its values/properties during execution

  • Strings and their properties
  1. Why can’t you add new properties to a string variable?: Because they are immutable

  2. What are rest parameters?: They are a variable length array of optional parameters of a function

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

  5. What is JSON?: JavaScript Object Notation, a flat (sequential in memory) format for storing object descriptions

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?: Compared to JavaScript objects, JSON requires all property names to be surrounded by double quotes and only allows simple expressions as values (e.g. no functions or bindings)

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?

Problem is how to make data structure to store daily logs of everything that Jacques has done on a given day to find patterns and determine what has triggered his transformations to wolf or squirrel.

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

Array is a data type for storing sequences of values and Object can store multiple different value types.

  1. What are properties in Javascript?

Properties are the values associated with a JavaScript object.

  1. Which values do not have properties?

In JavaScript almost all values have properties except null and undefined.

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

The two main ways to access properties in JavaScript are with a dot (where the word after the dot is the literal name of the property) and with square brackets (where the expression between the brackets is evaluated to get the property name).

  1. What are methods?

Methods are properties of string and array values that contain functions.

  1. What are objects?

Objects are all JavaScript values, except primitives (values that have no properties or methods).

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

With one object we can group different value types together into a collection of named values.

  1. How do you define an object?

Objects in JavaScript may be defined as an unordered collection of related data, of primitive or reference types, in the form of “key: value” pairs.

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

JavaScript objects are mutable: They are addressed by reference, not by value.

SECOND PART:

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

String values are immutable and cannot be changed. If you try to set new properties on them, it can’t be done because JavaScript doesn’t actually store those properties

  1. What are rest parameters?

When we want for our function to accept any number of arguments we can put three dots before the function’s last parameter. This parameter is called rest parameter. When such a function is called, the rest parameter is bound to an array containing all further arguments. If there are other parameters before it, their values aren’t part of that array.

  1. (Feel free to skip the sub-chapter of Math object and Destructing)
  2. What is serialisation and what is a use case of serialisation of data?

Serilisation is converting tangles of memory addresses to a flat description. We serialize the data so it can be stored or sent more easily.

  1. What is JSON?

JSON (JavaScript Object Notation) is a popular serialization format. It is widely used as a data storage and 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 expressions are allowed—no function calls, bindings, or anything that involves actual computation.

2 Likes
  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 introduces a variable which needs to be capable of holding multiple values.

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

  3. What are properties in Javascript?
    Properties describe a specific characteristics of a value in a data structure. Almost any value in JavaScript has properties.

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

  5. How can we access properties in a value (two ways)?
    The two possible ways are with a dot and the name of the property or the property within square brackets.
    myArray.length
    myArray[“length”]

  6. What are methods?
    Methods are functions which are part of of the properties of a value, they usually act on the value they are a property of.

  7. What are objects?
    Objects are a data structure which are capable of holding 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 capable of holding different data types and they may hold as many data types as needed.

  9. How do you define an object?
    An Object is defined by curly braces and each entry consist of a key/value pair separated by a comma. The key/value pair is distinguished by a colon.
    { food: “Burger”,
    pieces: [“bread”, “meat”, “lettuce”, “sauce”, “onions”]
    }

  10. What can you say about the mutability of Javascript objects?
    Unlike numbers, strings and Boolean’s, which are immutable values, objects can be modified. Their properties can be changed causing a single object value to have different content at different times.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Strings are a primitive type and not an object, therefore they are immutable.

  2. What are rest parameters?
    Rest parameters accept any number of arguments and are bound to an array. They are indicated with three leading dots (…name) before the variable name. They can be useful for functions to accept any number of 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?
    Serialisation allows to represent data in a flattened representation of the memory. This can be used to transfer data over the network.

  5. What is JSON?
    JSON stands for JavaScript Object Notation. It is a widely used data storage and communication format on the Web. The previously discussed serialisation is used to create this.

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

2 Likes

Arrays and Objects

  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 weresquirrel sub-chapter provides an introduction of how using an extensive data store can provide mathematical probability to the likelihood of an event.

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

In order to store multiple values within Javascript we can create an ‘array’.

  1. What are properties in Javascript?

Properties are values that derive from objects established by the coder using expressions within Javascript; being able to access them individually, selectively or all at once.

  1. Which values do not have properties?

Almost all values have properties apart from ‘null’ and ‘undefined’.

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

We can access properties in a value by:

  • a. referencing an index location using two square brackets for example, (fruits [3]). This will access the fourth fruit in the array, nominating the first as location 0;
  • b. using a dot and referencing a value held in the binding. For example, value.apples.
  1. What are methods?

Methods are properties that contain functions. Using these functions we can add values to the end of our arrays: fruits.push (5), delete a value: fruits.pop (), return all text to uppercase: typeof apples.toUpperCase, and return all text to lowercase: typeof apples.toLowerCase.

  1. What are objects?

Objects are an array of entries that store more information than just a string or value.

  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 can hold many different values and properties which other value types can’t.

  1. How do you define an object?

We define objects by creating a binding followed by listing the objects one by one within speech marks, each separated by a comma.

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

In Javascript, the text within strings can’t be altered or modified. However, the properties and values of the objects can be changed.

SECOND PART:

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

New properties can’t be added to a string variable because the values are immutable and can’t be changed.

  1. What are rest parameters?

‘Rest parameters’ are a function that call all the arguments in an array.

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

In order for extended complex stores of files of objects to be stored, as well as send those files to other computers, a JSON file can be utilized. This converts all the memory of addresses into small file – instead of needing to store the whole of your computer’s memory.

  1. What is JSON?

JSON stands for JavaScript Object Notation.

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

The main difference between JSON and plain Javascript written objects is that JSON’s data files only allow simplified direct expressions with no computations, functions or bindings. Also, all property names need to be surrounded by speech marks.

1 Like

1. A variable type is needed that can store multiple values and make them easy to access.

2. Array

3. Properties are the values associated with a JavaScript object.

4. null , undefined

5. objectName.property or objectName["property"]

6. Properties that contain functions.

7. A JavaScript object is a collection of unordered properties.

8. A object can hold different datatypes.

9. let anObject = {propertyOne: 1, propertyTwo: 2};

10. Javascript objects are not immutable. Their properties can be changed causing a single object value to have different content at different times.

SECOND PART:

1. Values of type string are not objects and immutable.

2. Rest parameters are bound to an array containing all additional arguments given to a function.

3. -

4. Serialization is the process of converting data structures or a object state into a format that can be stored. It is used to save data in a file or send it to another computer over the network.

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

6. Only simple data expressions are allowed and all property names have to be surrounded by double quotes.
[/quote]

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 needs to be an array so multiple values could be placed in one variable
  1. What variable type can be used in order to solve the problem of storing multiple values?
  • An array can be used in order to solve the problem of storing multiple values
  1. What are properties in Javascript?
  • Properties in Javascript are expressions that access some type of value
  1. Which values do not have properties?
  • Null and undefined values do not have properties
  1. How can we access properties in a value (two ways)?
  • We can access properties in a value by using a dot or square brackets. They differ because when using a dot, the word after the dot is the literal name of the property. Whereas, when using square brackets, the expression between the brackets are evaluated to get the property name
  1. What are methods?
  • Properties that contain functions are known as methods of the value they belong to
  1. What are objects?
  • Objects are arbitrary collections of properties
  1. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
  • They are able to hold as many databases as possible
  1. How do you define an object?
  • An object is something that has states and behaviors
  1. What can you say about the mutability of Javascript objects?
  • Objects are not immutable since you are able to change its properties. This causes a single object value to have different content at different times

PART2:

  1. Why can’t you add new properties to a string variable?
  • They are immutable
  1. What are rest parameters?
  • When a function is called, rest parameters are bound to an array containing all further 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?
  • Serialisation is the action of converting data into a flat description. It can be used as a data storage and a communication format on the web.
  1. What is JSON?
  • JSON(JavaScript Object Notation) is a serialisation format.
  1. What are the differences between JSON and the way programmers write objects in plain Javascript?
  • JSON requires double quotes and only allows simple data expressions. Also, comments are not allowed
1 Like
  1. It introduces the problem that he needs a way to store multiple values of data.
  2. Array.
  3. Properties in Javascript are the values inside an object.
  4. Null and undefined
  5. You can access properties in a value by using [ ] brackets or by typing a dot plus the name of the property, for example objectName [“property”] or objectName.property
  6. A JavaScript method is a property containing a function definition.
  7. Objects are arbitrary collections of properties, for example {firstName:“John”, lastName:“Doe”, age:50, eyeColor:“blue”};
  8. Objects can store different kinds of values, arrays for example can only store one type like numbers or strings.
  9. You define an object with curly braces, you then name a property and give it a value, each property is separated by a comma.
  10. Mutable is a type of variable that can be changed. In JavaScript, only objects and arrays are mutable, not primitive values.

(You can make a variable name point to a new value, but the previous value is still held in memory. Hence the need for garbage collection.)

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.

Second Part
1.String variables are immutable
2. Rest parameter is an improved way to handle function parameter, allowing us to more easily handle various input as parameters in a function. The rest parameter syntax allows us to represent an indefinite number of arguments as an array. With the help of a rest parameter a function can be called with any number of arguments, no matter how it was defined.
3.
4. Object serialization is the process of converting an object’s state to a string from which it can later be restored. It is useful when transferring data to another computer.
5. JSON stands for Java Script 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.
6. Properties in JSON have to be strings, and in JSON as string is defined as “a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes”. In other words using single quotes, or no quotes at all is not allowed.

1 Like
  1. The problems are needing to hold mutiple tipes of data. Strings and integers cannot do this.

  2. To store multiple values you use arrays.

  3. A property is what you give to value to make it do something.

  4. The values null and undefined do not have propertes.

  5. You can access a value useing a . or [].

  6. Methods are values that contain functions.

  7. Objects are arbitrary collections of properties.

  8. Objects can define things.

  9. You difine a object like this:

  10. All of the values that we have listed, such as: strings, integers, bolleans etc, cannot be changed. However useing objects we can chang them.

SECOND PART:

  1. Values of type string, number, and Boolean are not objects. This is why you cannot add a new property to a string.

  2. A rest parameter is bound to an array. If there are eny parameters befor it than those values won’t be part of that array.

3… I skiped the unesesary subchapters.

  1. To serialize data means to convert data into a flat discription.

  2. JSON is used for data storage and communication on the web.

  3. JSON has a few restrictions. All property names must be surounded in quotes. No functions, bindings, or enything that involves actual computation. Comments are allso not alowed.

2 Likes
  1. Arrays, a data type specifically created for storing sequences of values.
  2. Arrays
  3. Almost all values in JavaScript have properties. Some of these may be related to the length of a string or the name of an expression for example.
  4. Null and Undefinded are the only values with no properties.
  5. We can access properties by using . and []. When we use a dot, we access the literal name of the property after the dot. We use brackets to evaluate the property.
  6. Methods are properties that contain functions.
  7. Objects are arbitrary collections of properties.
  8. Objects help group different types of entries into a single value.
  9. NameOfObject = {Boolean : true, array : [“various”, “types”, 3, 5], etc : “String of text”};
  10. Whereas numbers, strings and Booleans are immutable, the properties of objects can be changed, thus making them mutable.

Second Part:

  1. You cannot add new properties to string variables as they are immutable.
  2. Rest parameters are bound to an array containing all further arguments. They are used to make functions accept any number of arguments.
  3. Serialization is the process of converting data into a standardized description of data, a flattened representation of the memory actually holding the data.
  4. JSON stands for JavaScript Object Notation, which is a popular serialization format.
  5. JSON takes data from JavaScript and converts it into a format that can be easily processed by other languages on the web. JavaScript values can be converted into the JSON format by using the JSON.stringify function. JSON data can be reconverted back into JavaScript by making use of JSON.parse.
2 Likes