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?
    Squirrel guy needs to use different types of data.

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

  3. What are properties in Javascript?
    Characteristics of values

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

  5. How can we access properties in a value (two ways)?
    With a dot (value.x) - with x being the literal name of the property, and with square brackets (value[x]) - with x being evaluated to get the property name.

  6. What are methods?
    Properties of a value that contain functions.

  7. What are objects?
    A type of value which is 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)?
    Problems that require working with different datatypes.

  9. How do you define an object?
    let object = {enter properties here}

  10. What can you say about the mutability of Javascript objects?
    They are mutable. Their properties can be changed, allowing an 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 immutable, unlike objects. They will not store new properties. “Changes” to a string will result in the creation of a new string.

  2. What are rest parameters?
    A syntax which allows a function to accept an indefinite number of arguments as an array. Only the last parameter in a function definition can be the rest parameter.

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

  4. What is serialisation and what is a use case of serialisation of data?
    A method of converting data into a "flat description that can be stored or sent.

  5. What is JSON?
    A format for serialization which is commonly used for data storage and communication on the web.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    In JSON all property names must be surrounded by double quotes and only simple data expressions are allowed (no computation).

1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    To work with a whole set of data instead of single variables.
  2. What variable type can be used in order to solve the problem of storing multiple values?
    Array
  3. What are properties in Javascript?
    Properites are specific characteristics of a value e.g. the length of a string or how many elements are stored in an array with .length.
  4. Which values do not have properties?
    Null and undefined
  5. How can we access properties in a value (two ways)?
    value.property or value[property]
  6. What are methods?
    Properties that contain functions, which can be used to manipulate the value.
  7. What are objects?
    Values of type Object are arbitrary collections of properties.
  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    To combine different value types in one set of data which can be grouped in a single value.
  9. How do you define an object?
    One way to create an object is by using braces as an expression.
  10. What can you say about the mutability of Javascript objects?
    You can change their properties, causing a single object value to have different content at different times. So they are not immutable.



  1. Why can’t you add new properties to a string variable?
    Because string values are immutable.
  2. What are rest parameters?
    The rest parameters gather all remaining arguments into an array
  3. What is serialisation and what is a use case of serialisation of data?
    Serialization converts the in-memory data structure of an object or array to a string value that can be stored or transferred to other machines or saved to a disk.
  4. What is JSON?
    JavaScript Object Notation. It is widely used as a 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?
    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?

JavaScript provides a data type specifically for storing sequences of values which cannot be solved efficiently using variable types such as strings or integers.

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

It is called an array and is written as a list of values between square brackets, separated by commas.

  1. What are properties in Javascript?

Properties are the values associated with a JavaScript object.

  1. Which values do not have properties?

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

  1. What are methods?

Properties that contain functions are generally called methods of the value they belong to, as in “toUpperCase is a method of a string”.

  1. What are objects?

Objects are values of 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)?

Mutability.

  1. How do you define an object?

An object is a standalone entity, with properties and type.

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

Objects in JavaScript are mutable. You can change their properties, causing a single object value to have different content at different times.

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

If you try to add a new property, it doesn’t stick as they are immutable.

  1. 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. The rest parameter syntax allows us to represent an indefinite number of arguments as an array.

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

Serialisation means converting data into a flat description. A popular serialisation method is JSON.

  1. What is JSON?

A popular serialization format is called JSON, which stands for JavaScript Object Notation. 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 differences. 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. We need to store a representation of properties around daily events, which becomes extremely difficult and complex only using strings and integers.

  2. An object

  3. Provide elements / information about a value. We use property’s name to access this information about a value

  4. Null & Undefined

  5. Bracket or dot notation e.g value.propertyName or value[“propertyName”]

  6. Methods are functions that are a property of a value

  7. Objects are a value that store a collection of properties

  8. Objects are mutable whilst other value types are not, this allows the property values to be changed and allowing an object to be used multiple times.

  9. let objectName = { property name : value }

  10. It allows us to reuse the same object to represent variations of the same thing because we are able to update the contents of their properties. E.g Have an object of dog and within have properties of breed, age, colour. We don’t have to declare a new variable for each new dog.

Second Part

  1. They are not objects
  2. The enable you to pass through a parameter where it could be infinite. E.g newFunction(…parameter) i can pass through 1, or [1,2,3,4]. Doesn’t matter.
  3. Serialisation flattens data and allows us to communicate it over the web instead of trying to communicate our own local computer memory positions
  4. Javascript Object Notation
  5. JSON requires the property name and value to have " " around them
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?

Sorting sequences of values

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

It is called array and is written as: nameOfArray = [Value 0, Value 1, Value 2…]

  1. What are properties in Javascript?

They are characteristics about the given value. e.g color, length …

  1. Which values do not have properties?

null and undefined

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

value.x and value[x] (x is the property)

  1. What are methods?

A number of properties that hold function values.

  1. What are objects?

Objects are data structures that are capable of containing an arbitrary collection of properties. These are created using braces to contain a list key/value pairs separated by a comma.

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

They can store many different value types in itself.

  1. How do you define an object?

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

let week = [
{days : [“monday” , “tuesday”, “wednesday” , “thursday”, “friday”],
weekend: false}
];

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

You can change the property of an Object, causing a single object value to have different content at different time.

SECOND PART:

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

because it is immutable

  1. What are rest parameters?

Rest parameter accept all following argument. It is defined by three dots in a row (…).

  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?

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.

  1. What is JSON?

JavaScript Object Notation is a notation for data storage and communication.

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

JSON requires double " " quotes for all property names not single quotes ’ '.

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?
    JavaScript provides a data type for storing sequences of values that cannot be solved using variable types such as strings or integers.

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

  3. What are properties in Javascript?
    Properites are characteristics of a value such as the number of elements in a string. Some properties can be changed, added or deleted.

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

  5. How can we access properties in a value (two ways)?
    objectName.property or objectName[“property”]

  6. What are methods?
    Methods are properties that contain functions. For instance, the push method is used for adding values to the end of an array while the pop method removes the element at the end of an array.

  7. What are objects?
    Objects are a data type that allows us to collect different types of properties together. For example, an object can contain an array and a boolean at the same time.

  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)?
    The problem of immutability.

  9. How do you define an object?
    Values that have an arbitrary collection of properties, which is noted as square brackets [ ].

  10. What can you say about the mutability of Javascript objects?
    With objects, it is possible to change their properties. One object can have different properties at the same time.

Second part:

  1. Why can’t you add new properties to a string variable?
    It is immutable. You cannot change their properties.

  2. What are rest parameters?
    Rest parameters allow functions to accept an undefined amount of arguments as an array.

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

  4. What is serialization and what is a use case of serialization of data?
    Serialization converts code and stores it in the computer’s memory. By converting the data into a flat description, it becomes transferable over the network.

  5. What is JSON?
    JavaScript Object Notation (JSON). It is used often as the serialization format.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    All property names must be in double quotations. Only simple data expressions are allowed, with no function calls, binding or anything requiring 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?
    Jacques has to keep a record daily writing variables tracking this way what causes his transformation, then to solve his problem he needs a data structure to store the informations.

  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?
    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?
    The Null type has exactly one value: null .
    A variable that has not been assigned a value has the value undefined .

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

  6. What are methods?
    A method is a set of code which is referred to by name and can be invoked at any point in a program simply by utilizing the method’s name.

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

  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    Objects can store different kinds of values in one value while for example arrays only can store one type of value like numbers or strings.

  9. How do you define an object?
    Objects in JavaScript are dynamic collections of key-value pairs. The key is always a string and has to be unique in the collection. The value can a primitive, an object, or even a function.

  10. What can you say about the mutability of Javascript objects?
    Mutable objects are objects whose value can change once created, while immutable objects are those whose value cannot change once created. Objects, arrays, functions and sets are mutable.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    In JavaScript numbers, strings, null, undefined and Booleans are primitive types which are immutable.

  2. What are rest parameters?
    The rest of the parameters can be included in the function definition by using three dots … followed by the name of the array that will contain them.

  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?
    Data serialization is the process of converting data objects present in complex data structures into a byte stream for storage, transfer and distribution purposes on physical devices.

  5. What is JSON?
    JSON stands for Javascript Object Notation, is a lightweight format for storing and transporting data and often used when data is sent from a server to a web page
    JSON is “self-describing” and easy to understand.

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

there’s nothing called JSON object, its either JSON string/text or JSON data. JavaScript Objects do exist.

JavaScript objects do not contain single or double quote marks around the keys when no spacing is used in the key name. So, if there’s spacing in the key name, quotes are used.

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 specific problem this section introduced was mapped data sets. For example, a collection of strings each corresponding to a number that represents possible histogram. In the case of the books example, it was a string to boolean mapping where the key string represents what the person did that day and the value corresponding to that key represents a boolean (true or false) whether that person turned into a squirrel or not.

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

The array comes in handy when dealing with collections of values all of possibly different types.

3. What are properties in Javascript?

Properties belong to objects in JS. Each property maps to a specific value which could be a number, boolean, string object, array object, or even a function.

4. Which values do not have properties?

primitive values such as numbers and booleans don’t have properties.

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

Using dot operator -> obj.property
OR
using the bracket notation -> obj[property]

6. What are methods?

Methods are properties of objects whose value is a function. Methods allow objects to interact with the code outside of themselves and potentially change their state (i.e. the value of one or more of their properties).

7. What are objects?

Objects are just another data storage mechanism in JS that contain one or more properties each of which corresponds to a value which could be of any type (number, boolean, function, string, array, another object, etc.)

The value for each property can be accessed by using either the dot or bracket notations discussed in the answer to the question above.

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 specifically solve the mapping problem real well; how to represents a collection of data that has some correspondence or mapping with each other.

In Objects the keys map to the properties which are usually any value type.

9. How do you define an object?

An object value is stored using a variable or binding just like a number value or a string object value but the object value is defined using a set of open and closing curly braces.

For example, the below defines an empty object:

var myObject = {};

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

JS objects are mutable in the sense that if an object is bound to a variable that is const the properties of the object can still be changed, but the binding cannot i.e. the variable cannot be bound (assigned) to a different object.

SECOND PART:

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

Even though strings are objects in javascript, they are one of the primitive objects in javascript meaning that they cannot be modified by the programmer i.e. the programmer cannot add properties to them.

2. What are rest parameters?

Rest parameters is just another name for variable argument lists inside functions in Javascript. So rest parameters are parameters to functions that can vary in number and are usually written in a function definition using the “…” notation.

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

Serialization is just a process of converting code and the data used within the code to chunks of bytes that can then be transmitted to a file, database, and / or hard drive memory to be stored permanently.

5. What is JSON?

JSON is a format for representing data as key-value pairs, similar to Javascript object literals.

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

An object literal in JS is a data structure in memory, while JSON data is just a large string that looks like it is an object literal but really represents some data (for e.g. some data sent back from the server to the browser or from one program to another etc).

JSON is not dependent on the programming language being used while object literals are a built in feature of js.

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?

Data structuring

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

Array

What are properties in Javascript?

Properties are the values associated with a javascript object

Which values do not have properties?

undefined and null

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

With a dot and with a square bracket

What are methods?

Properties of values that contain functions

What are objects?

Objects are values that are arbitrary collections of properties. They, as well arrays (which are a specific kind of object), provide ways to group several values into a single value.

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

Both objects and arrays can store mutable values unlike other value types like integer, string, boolean etc.

How do you define an object?

An object is a value that holds multiple values, and cannot be identical to another value.

What can you say about the mutability of Javascript objects?

The properties of objects can be changed; giving an object value to have different content ( properties, values) at different times.

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

Strings are immutable

What are rest parameters?

Rest parameters allow a function to accept any number of arguments. These are written as three dots before its name.

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

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

Converting data into a flat description. It is used as a data storage and communication format on the Web by javascript and other languages

What is JSON?

A popular serialization format, which stands for JavaScript Object Notation,

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

In JSON, all property names have to be surrounded by double quotes, and no function calls, bindings, or anything that involves actual computation. Comments are not allowed in JSON.

1 Like

PART 1

  1. Other types of variables can only hold 1 value and cannot be changed from one type of variable to another. The Weresquirrel needed to be able to store multiple values in an easily organized way.
  2. Arrays
  3. Properties hold characteristics of most values in JavaScript. You can use Properties to access the desired property a of string, an array, and more.
  4. Null and Undefined
  5. You can access properties by writing array.DesiredProperty or doing array[DesiredProperty] both ways of calling a property are used and executed differently by the computer.
  6. Methods are properties that hold functions on their specific type of datatype. ex: Math.min will find the smallest number in a group of numbers. “Min” is a property of the built-in Math function.
  7. Objects are groupings of data represented as one unit.
  8. Objects can be filled with multiple types of data whereas arrays, strings, and others can only store 1 type of data.
  9. Objects are defined by a binding then the values, however many, are encased in curly brackets, and separated by commas. ex: let cheese = {type: "Gouda" , age: 5};
  10. You can change the data within an object which makes them completely mutable, but that can make your code get super complicated.

PART 2

  1. Because string variables are immutable and cannot be changed.
  2. Rest parameters are used to pass an array’s contents as arguments to a function. You call it by writing 3 dots and then array name. Ex: function highestNumber(...array) Then regular function structure afterwards.
  3. Skipped
  4. Serialization is converting code to a flat version of itself and a use case is if you want to send someone else your code sending them your entire computer memory would not be ideal - for storage and safety reasons. Instead you can flatten your code so you can send it without all the other added data. Saves time and computer memory.
  5. JSON Stands for Java Script Object Notation. It is a popular serialization format.
  6. JSON looks simliar to how objects and arrays are written but is ristrictive sometimes since it can only be used on objects/arrays with simple data expressions (so the objects/arrays cannot be completing any kind of computation.) The only difference style wise for writing in JSON terms is you must enclose all property names in double quotes.
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?

Weresquirrell uses multiple sets of data. Integers cannot contain multiple sets of datas. Strings could represent the data as they can have any length, however this is too awkward.

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

Arrays

  1. What are properties in Javascript?

In Javacript almost all values have properties. Properties are the values associated with a JavaScript object. They can usually be changed, added, and deleted but some are read only.

  1. Which values do not have properties?

Null and undefined

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

A property can be accessed by using expressions. An example of this is the mystring.length expression. This will access to the length property of the value myString. Math.max, gives us access to the property named max in the Math object.

  1. What are methods?

Methods are properties that contain functions. Examples are the .toUpperCase(), push and pop methods. etc

  1. What are objects?

Objects are collections of properties. Almost “everything” in JavaScript is an 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)?

It allows us to group data/multiple value types into a single value. We can not do this with the other value types.

  1. How do you define an object?

Object values are written as – name: value Example:

const person = (firstName: “Bruce”, lastname: “Lee”, status: “legendary”);

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

Most objects can be modified, numbers, strings and Booleans are immutable meaning it is impossible to chance values of those types.

PART TWO

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

Because they are immutable meaning their values are not objects.

  1. What are rest parameters?

When a function accepts any number of arguments, the user supplied parameters are placed within a JavaScript array and the last parameter is the rest parameter in the function. This is bound to the array containing all further arguments.

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

Serialisation is the process of translating data into a format that can be stored like a file. This is so we can send it easily to others.

  1. What is JSON?

JSON is JavaScript Object Notation, it is used widely as a data storage amd communication format on the web for multiple languages

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

The differences are:

  • All property names have to be surrounded by double quotes
  • Only simple data expressions are allowed
  • No function calls, bindings or anything that involves computation
  • Journal entries also aren’t allowed.
1 Like
  1. Strings and integers can only store a single value whereas in this case the storing of multiple values in a single variable is required.
  2. An array can be used to store multiple values in a single variable.
  3. A property is an aspect of a defined value.
  4. The values that don’t have properties are the nonvalues null and undefined.
  5. By using a period or square brackets i.e. value.x or `value[x]
  6. Methods are predefined JavaScript functions that can act on the property of a value.
  7. Objects are arbitrary collections of properties.
  8. Objects allow for multiple data types to be used.
  9. An object is defined by using braces to encapsulate the values of a given variable.
    i.e:
var object = {
 value1:value
 value2:[value1, value2 ... values]
}
  1. The values of JavaScript objects can be manipulated unlike other data types i.e. strings.
  1. Primitives are immutable.
  2. Rest parameters are array pointers and the array they are bound to contains all further arguments for that particular function.
  3. :+1:
  4. Serialization is the creation of a flat description of the data for transmission/storage.
  5. JSON (JavaScript Object Notation) is a file format for storage/transmission of serialised data.
  6. All property names must be surrounded by double quotes, only simple data expressions are allowed and comments are not allowed in 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?
He needs a data structure to store the information he’s been collecting.

What variable type can be used in order to solve the problem of storing multiple values?
JavaScript provides a data type for storing sequences of values. It is called an array and is written as a list of values between square brackets, separated by commas.

What are properties in Javascript?
A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure. For example, the elements of an array are stored as properties of the array.
The number of elements in the array is also a property of the array. They can also be expressions that access a property of some value like .lenght or .max

Which values do not have properties?
null and undefined

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

What are methods?
Properties that contain functions are called methods

What are objects?
Values of the type object are 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)?
Objects can store values of different types

How do you define an object?
We define an object by using curly braces.

What can you say about the mutability of Javascript objects?
Object values can be modified. You can change their properties, causing a single object value to have different content at different times.
With objects, there is a difference between having two references to the same object and having two different objects that contain the same properties. When you compare objects with JavaScript’s == operator, it compares by identity: it will produce true only if both objects are precisely the same value. Comparing different objects will return false, even if they have identical properties. There is no “deep” comparison operation built into JavaScript, which compares objects by contents

Strings and their properties:

Why can’t you add new properties to a string variable?
It is impossible to change values of those types as they are immutable. But these types do have built-in properties. Every string value has a number of methods.

What are rest parameters?
Rest parameters are bound to an array,which contains all further arguments. This allows functions to allow any number of arguments.
To add a rest parameter use three dots before the function’s last parameter.

What is serialisation and what is a use case of serialisation of data?
Because properties only grasp their value, rather than contain it, objects and arrays are stored in the computer’s memory as sequences of bits holding the addresses of their contents.
If you want to save data in a file for later or send it to another computer, you have to convert these memory addresses to a description that can be stored or sent. What we do is serialize the data. That means it is converted into a flat description.

What is JSON?
Is a serialization format which stands for JavaScript Object Notation.
It 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?
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 main problem brought up is the storage of value sequences. Numbers, strings, booleans etc. they are primitive values, which store unique data. Any attempt to use a string for storage would be counterproductive, as it would create a new problem to access and extract individual data, converting it to the original value type.

  2. You can use an array. It is an object specially created to store a sequence of values, individually identifiable by their position (index).

  3. Properties are characteristics associated with values. When referring specifically to objects, properties are the values stored in them.

  4. Null and undefined values have no properties.

  5. (a) Dot notation –we can write the name of the object (or other value type), followed by a dot and the name of the property of that value we want to access.
    (b) Square bracket notation – we can write the name of the object (or other value type), followed by square brackets in which you write the property you want to access.

  6. Methods are functional actions that can be applied on certain values. There are some actions that are native to JS. But it is possible to create methods too, through functions. In objects, a new method can be inserted into it by defining a function as a property value of that object.

  7. Objects are one of the types of derivative values present in JavaScript. It consists of a variable linked to hierarchically organized collections of other values.

  8. In objects, it is possible to link a variable to several values, which can be organized hierarchically. This makes it easy to access. Also, objects are mutable by changing their properties.

  9. A variable is linked to a group of values surrounded by ‘braces’ (object literals). These group of values will be called the object’s ‘properties’. Each property has a property name that is linked by a colon : to the value of that property. Each property is separated from the other by a comma.

  10. Object contents can be modified when we change their properties. They differ from other value types, such as numbers, strings, booleans, which content is immutable.

PART 2

  1. The contentes of values like numbers, strings, booleans, are immutable. This means that once inserted in a code, they cannot be modified by means of another code later. The only supported properties are the native (built-in) JavaScript ones.

  2. ‘Rest parameter’ is a JS notation (syntax) represented by ellipsis (three dots), which allows us to represent an indefinite number of parameters (arguments) in a function. These additional arguments (with no defined quantity) are represented as an ‘array’ that will contain all these possible arguments.

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

  4. Serialization is the conversion of data into a descriptive address that allows it to be located and sent. An example would be a link to a Dropbox file.

  5. JSON (JavaScript Object Notation) is a notation format used for storage, data transport and communication. Its syntax rule is based on how JavaScript objects are created, but it can be used in several computer languages. As it is a text-only syntax, it is a well-known form of data serialization (transformation of data into descriptive text).

  6. (a) Its values cannot be a function or an undefined value. It also cannot be a date. (b) Only ‘simple data’ expressions (unit values) are allowed. Thus, it is not allowed to call functions, create links or any commands that require computational execution (‘actual computation’). (c ) All data is individually composed of name/value pairs. Name and value are separated by a colon (‘colon’). (d) Data are separated from each other by commas (‘commas’). (e) All strings must be written with double quotes (either the name or the value) and enclosed in braces. (f) Inserting programmer comment is not allowed in JSON.

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?

Because strings and integers are only able to hold a single type of data and the kid needs the data structure to store multiple values and datatypes.

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

Arrays.

  1. What are properties in Javascript?

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

  1. Which values do not have properties?

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

  1. What are methods?

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

  1. What are objects?

Objects are a standalone entities, with properties and types.

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

Objects are able to hold different types of data.

  1. How do you define an object?

By placing the data within brackets.

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

Immutables are the objects whose state cannot be changed once the object is created.

Second part:

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

Because a string is not an object; instead, it is a primitive type and it is also immutable.

  1. What are rest parameters?

The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

  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?

Serialization converts data into a flat description of itself. This allows us to use JSON notation to convert data between data types, from string to the value it holds.

  1. What is JSON?

JavaScript Object Notation and it is a popular serialization format.

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

In JSON, all property names have to be surrounded by double quotes, and only simple data expressions are allowed.

1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    The calculation cannot be solved by just solely string nor number, but need both of them together in the data set.

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

  3. What are properties in Javascript?
    Properties are expressions that access a property of some value.

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

  5. How can we access properties in a value (two ways)?
    .n / [n]

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

  7. What are objects?
    Objects are data structures that are capable of containing an arbitrary collection of properties. These are created using braces to contain a list key/value pairs 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)?

Object tie different properties together to express a single condition. This allows programmers to better represent how a system should behave.

  1. How do you define an object?

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

  1. What can you say about the mutability of Javascript objects?
    They are mutable that can be modified

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Because it is immutable. because it is not object

  2. What are rest parameters?
    Rest parameters are bound to an array, which contains all further arguments. This allows functions to allow any number of arguments. To add a rest parameter use three dots before the function’s last 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?
    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. What is JSON?
    JavaScript Object Notation is a notation for data storage and communication.

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

JSON requires double quote

1 Like
  1. keeping a log of data is prohibitively difficult for all but the smallest datasets without some other type of variable than strings or integers, which can only take one value at a time… entire datasets are much easier to manipulate when the constituent data are all stored in a common format on which functions can operate over the whole set.

  2. we’ve seen arrays store multiple values here… maybe that was in the extra reading somewhere? i feel like this is not news…

  3. Properties are named elements of variables akin to metadata, e.g. the length of an array or the upper/lower “case-ness” of a string

  4. two ways to access properties: .property syntax and bracket syntax (variable{“property”}); they are strings but don’t require the quotes when using valid binding names under the .property syntax.

  5. Methods are properties that call functions on the parent object when accessed, e.g. parentObject.toUpperCase()

  6. Objects are essentially a data type defined by the user, …

  7. …when the user declares the object and its properties/methods using braces: e.g.
    let objectName = {
    propertyName : [value …];
    propertyName1 : [value0, value1, …]
    };

  8. Objects allow one to manipulate data in ways in which pre-defined data types otherwise have a very difficult or impossible time.

  9. …see question 7’s answer…

  10. javascript objects are mutable in the sense that their values can be changed (plus something about identity and precise same-ness OOF!)… i don’t even know what that means! the book description was not super simple to me… HELP! anyone have a clever metaphor for what mutability is and isn’t in JS?
    maybe the best i could come up with was that “rat” can never equal “cat”, so these two are immutable, but an object’s value CAN equal another object’s value… waddaya think??


2-1. Strings are immutable, so you can’t add new properties to it… still unsure why that means no new properties, but whatever for the time being (hopefully i’ll get some more hints in the reading or here…) …i guess that would mess with their identity and thus make them not the same as themselves, i.e. it would no longer be the same value on which you’re working, so it makes no sense to do…

2-2. Rest parameters are literally ellipses, i.e. “…”, and act like “filler” that substitutes for parameters that are stored elsewhere as part of an array, i.e.it breaks the array down into its component elements and uses each one as an input parameter to the function called with the ellipse, which is not the same as inputting the array itself as the parameter.

2-3. i tried skipping it… it’s like why have a question 2-3 if you’re just going to say skip it… (“they’re always watching you…” is what my mom learned after a beauty contest…)
the Math object is just a special object always hanging around for the convenience of providing any of its common math functions provided, it’s globally available, but keeps the namespace clean by keeping all its function names local (i.e. as property names)
AFAICT destructuring is basically just the rest parameter idea but for functions: i.e. declaring var names as the parameters of a function’s input in order not to have to spell it out inside the function, i.e. bindings for each element as opposed to just the entire array

2-4. serialization is (it sounds like according to the context of the reading assignment) what happens when your computer memory’s contents are converted from binary code into values that can be stored or reused/reloaded elsewhere (i.e. without needing to reproduce the exact RAM configuration that was present when you last used javascript for all that programming you did), obvious use cases being saving or sending data to another computer/memory

2-5. JavaScript Object Notation is a protocol that’s basically a restricted subset of read-only instructions from javascript, i.e. a serialization format, which is useful for essentially saving/exporting from memory the data with which you’ve been working in JS to a file (a json file) and/or send it elsewhere (anywhere that doesn’t have access to your computer memory)

2-6. one difference between objects in javascript v. JSON is that properties in JSON must use double quotes, but more importantly in JSON no computation is allowed, i.e. it’s essentially read-only, so no dynamic values

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 type for storing a sequence of values
  2. What variable type can be used in order to solve the problem of storing multiple values?

    • An array
      • e.g, let listOfNumbers = [3, 666, 56, 5, 23];
        • Console.log(listOfNUmberas[2];
          • // 56
  3. What are properties in Javascript?.

    • Expressions that access a property of a value
      • Eg myString.length
        • Length property of value in myString
  4. Which values do not have properties?

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

    • Dot
      • value.x
        • Word after dot literal name of property
        • Fetches the property of value named “x”
    • Square brackets []
      • value[x]
        • Expression between brackets is evaluated to get property name
        • Tries to evaluate the expression x & use the result
  6. What are methods?

    • Properties that contain functions
  7. What are objects?

    • Values of the type object are arbitrary collections of properties
  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?

    • hold as many different datatypes as we need
  9. How do you define an object?

    • Using braces as an expression
  10. What can you say about the mutability of Javascript objects?

    • Objects are mutable
    • Strings, integer, Boolean are immutable
  11. Why can’t you add new properties to a string variable?

    • String, number & Boolean variables are immutable
  12. What are rest parameters?

    • When a function is called the rest parameter is bound to an array containing all further arguments
  13. What is serialisation and what is a use case of serialisation of data?

    • Data is converted to a flat description
    • This allows you to more easily store save data to a file or send across a network
  14. What is JSON?

    • Serialisation format
      • JavaScript Object Notation
    • Widely used as a data storage and communications format for the web
      • Even in languages other then JS
  15. What are the differences between JSON and the way programmers write objects in plain Javascript?

    • All property names have to be surrounded by double quotes & only simple data expressions are allowed
      • No function calls, bindings or anything that involves actual computation
      • Comments are not allows either
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?
    There needs to be a way to store an amount of data to later use for an application.
  2. What variable type can be used in order to solve the problem of storing multiple values?
    Arrays
  3. What are properties in Javascript?
    Poperties can give you access to information of a value such as length or maximum.
  4. Which values do not have properties?
    null and undefined
  5. How can we access properties in a value (two ways)?
    value.propertie (only for values held in the binding) or value[“propertie”]
  6. What are methods?
    Methods are properties which hold a function value.
  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 hold many different value types at once.
  9. How do you define an object?
    Objects are defined by braces.
  10. What can you say about the mutability of Javascript objects?
    Objects´ properties can be changed, which makes them unique.
1 Like

PART 2

  1. Why can’t you add new properties to a string variable?
    Values like strings, booleans and numbers cannot be cahnged.

  2. What are rest parameters?
    Rest parameters are bound to an array and contain all further arguments.

  3. What is serialisation and what is a use case of serialisation of data?
    Seralisation means, that data is converted into a flat description. It is used for data storage.

  4. What is JSON?
    JavaScript Object Notation is a popular serialisation format.

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    In JSON only simple expressions are allowed and no comments. It means there is no computation possible in JSON. Alo all property names need to be surrounded by double quotes.

1 Like