Data Structures (Arrays and Objects) - Reading Assignment

  1. In the weresquirrel example, we needed a data structure that could accommodate different types of data and not just simple strings or integer values. We needed something that could be a mish-mash of whatever we want. Therefore, we learned about objects.

  2. Objects, which can be a mashup of whatever we want (mostly), can also be indexed and stored in an array of our object type.

  3. Properties are characteristics of a variable. For example, a string has a length. Length would be the property of the type string.

  4. Null and undefined don’t have properties.

  5. We can access properties by using the dot (".") notation, or by using the square bracket notation.

  6. Methods are essentially properties whose values are bound to a function.

  7. An object is a complex datatype that can be a collection of arbitrary properties.

  8. Objects allow us to define the type of data we want to be gathered and how it is accessed.

  9. We use the curly-bracket notation to define an object.

  10. The mutability of objects allow us to have multiple bindings with the exact same identity. Standard data-types don’t allow this.

  11. We can’t add properties to native data-types because the language doesn’t allow it.
    2 The rest parameter syntax allows us to pass an indefinite number of arguments to a function as an array.

  12. Serialization is the process of taking information (in this case memory locations of contents of arrays) and representing it in a “flat” (I prefer linear) presentation. One use case is to communicate our code to another computer or network.

  13. JavaScript Object Notation.

  14. Property names have to be in double quotes, and only simple data expressions are allowed (ie. no function calls).

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?

There are so many values that all apply to the same thing, we need to be albe to store multiple values as the same type of variable.

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

Arrays

What are properties in Javascript?

Properties are attributes of a value that describe it and can be called, such as length.

Which values do not have properties?

undefined and null

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

object.property
object[“propertyvalue”]

What are methods?

Method are functions stored as properties that can be called to perform their function

What are objects?

objects are values that 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 contain multiple properties that each hold their own values and can be used to manipulate the information contained within the object

How do you define an object?

An object is defined by by a list of properties and their values. An object can be created like this:
let object1 = {
name: “Mr. Ojbect”,
age: “30 seconds”,
weight: “A few extra bytes”,
hight: 42
}

What can you say about the mutability of Javascript objects?

objects can be changed. Values within the properties can be updated or removed as need.

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

It would be an entirely different string if it were changed.

What are rest parameters?

rest parameters allow a function to accept an infinite number of paramters, it is used by having “…” before the functions last parameter.

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

Serialization of data is the process of converting it to a flat description.

What is JSON?

JSON is JavaScript Object Notation. It is the language based on ordered paires of property and values.

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—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?
    Accessing specific parts of strings and integers cannot be easily done. Data structures are a better solution for this kind of issue.

  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.

  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. Examples: value.x, value[x]

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

  7. What are objects?
    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)?
    Solves immutability. You can change their properties.

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

  10. What can you say about the mutability of Javascript objects?
    Enables a single object value to have different content at different times.

Part Two

  1. Why can’t you add new properties to a string variable?
    String variables do not store properties.

  2. What are rest parameters?
    Accepts any number of arguments. Is bound to an array containing all further arguments. If other parameters before it, their values are not a part of that array.

  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?
    Converts data stored memory into a flat description that can be stored or sent. If you would like to save data in a file for later or send it to another computer over the network, you have to somehow convert the tangles of memory addresses to a description that can be stored or sent.

  5. What is JSON?
    A popular serialization format. Stands for JavaScript Object Notation.

  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, binding, or anything that involves actual computation. Comments are also not allowed.

1 Like

1. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
Jacques needed a structure where he can store a set of values of various types which couldn’t be possible using primitive types.

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

3. What are the properties in Javascript?
Characteristics of a value represent properties.

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

5. How can we access properties in a value (two ways)?
First: using dot notation eg. value.x;
ps: Dot notation has an exception that it can only be used for properties complying with the valid binding names.
Second: using bracket notation eg value[x].

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

7. What are objects?
Objects define a structure for storing an arbitrary collection of 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)?
Objects are mutable and also allow user-defined properties.

9. How do you define an object?
Objects are defined as expressions with key-value pairs.
For instance :
var obj = {};
obj.prop1 = “value1” ;
obj.prop2 = “value2” ;

10. What can you say about the mutability of Javascript objects?
Javascript allows modifications of objects to have various assignments and properties.

SECOND PART:

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

2. What are the rest parameters?
Rest parameters facilitate a function to accept any number of arguments bounded to an array.

3. What is serialization and what is a use case of serialization of data?
Serialization takes an in-memory data structure and converts it into an easy store and transfer format.
Use case: To facilitate intermachine communication.

4. What is JSON?
JSON is a serialized format used as a data storage and communication format on the web.

5. What are the differences between JSON and the way programmers write objects in plain Javascript?
In JSON, all the properties are surrounded by double quotes. Only simple expressions are allowed without any function calls and computations.
In the case of objects, double quotes are only used for properties not complying with proper binding names.

1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    Storing Values in a specific row cannot be solved by strings and intergers.

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

  3. What are the properties in Javascript?
    Properties are values defined inside an Object.

  4. Which values do not have properties?
    Undefined and Null are the most common ones.

  5. How can we access properties in a value (two ways)?
    By calling it using the dot or bracket signs.

  6. What are methods?
    Methods are functions that live inside a object.

  7. What are objects?
    Objects are pretty much what describes elements in an array, Objects = car or toys or trees.

  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 complex data than primitive types

  9. How do you define an object?
    By giving the elements inside a = and storing it in curly brackets.

  10. What can you say about the mutability of Javascript objects?
    If you are not careful your code becomes complex to read.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Strings are primitive value can’t go any lower than strings.

  2. What are the rest parameters?
    Rest parameters accepted by a function which do not have a specific number of parameters.

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

  4. What is serialization and what is a use case of serialization of data?
    Serialization is storing your data structures in a transfer-compatible format.

  5. What is JSON?
    JSON is the standard for serilization of objects in Js.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript? In JSON you have to wrap keys and values with double quotes and they cant define methods.

1 Like

PART1

  1. A variable that can store multiple arguments is needed.

  2. An array.

  3. Properties are expressions. With a property you can give an argument a certain feature for example making it look larger than it actually is.

  4. Null.length

  5. You can acces a value with a dot and square brackets “value.x” or “value[x]”.

  6. Properties that contain functions are methods.

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

  8. You can store different types of datatypes (values).

  9. Braces: the start of a statement, they start a block of statements. In any other position, they describe an object.

  10. objects are mutable.
    strings, numbers, booleans are immutable.

PART 2

  1. Strings are immutable.

  2. It is a parameter inside a function’s parenthesis and is proceeded with ellipsis ‘…’ and it allows us to put in multiple arguments.

  3. Ok.

  4. When data is transferred over into a serial code and stored in it, I think they use it in blockchain and they use it to store and sort the data.

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

  6. JSON requires all property names to be surrounded by double quotes and only simple data expressions are allowed meaning no comments, function calls, binds or anything that involves actual computation 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?
    It’s only able to store single data.

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

  3. What are properties in Javascript?
    Is a characteristic of an object, often describing attributes associated with a data structure. For instance, properties hold data that are specific to a given object instance.

  4. Which values do not have properties?
    Undefined and null are the only two JavaScript values where we get an exception if we try to read a property .
    For example:
    null.length;
    // → TypeError: null has no properties

  5. How can we access properties in a value (two ways)?
    The two main ways to access properties in JavaScript are with a dot and with square brackets. Both value.x and value[x] access a property on value —but not necessarily the same property.

  6. What are methods?
    JavaScript methods are actions that can be performed on objects. Methods are functions stored as object properties.

  7. What are objects?
    An object is a collection of properties, and a property is an association between a name (or key) and a value.

  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    An object can hold a collection of related data and functionality.

  9. How do you define an object? An object begins by defining and initializing a variable. For example: const person = { };

  10. What can you say about the mutability of Javascript objects?
    Arrays and objects are not immutable in JavaScript because they can indeed change their value over time.

2nd Part:

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

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

  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 takes an in-memory data structure and converts it into a series of bytes that can be stored and transferred.

  5. What is JSON?
    A popular serialization format is called JSON (pronounced “Jason”), 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.

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

2 Likes

Part 1:

  1. A data structure to store different kinds of information.
  2. An object.
  3. An attribute of a value.
  4. Null and undefined.
  5. With a dot (value.x) or with square brackets (value[x]).
  6. Properties that contain functions.
  7. Collections of values with accessible properties.
  8. Storing data with different types of values in a structured way.
  9. By defining their values and properties.
  10. Objects with the same values and properties are not necessarily the same, unless they are defined to be the same by binding.

Part 2.

  1. String variable is not an object and it’s immutable.
  2. Three dots (…) before a parameter is bound to an array containing arbitrary number of arguments.
  3. Converting data into a flat description for saving data or sending it over to another computer.
  4. A popular data storage and communication (serialization) format.
  5. All property names have to be surrounded by double quotes and only simple data expressions are allowed. JSON doesn’t include anything that involves actual 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?
    Creating a special data structure to store different values and information.

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

  3. What are properties in Javascript?
    Properties are values within an object.

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

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

  6. What are methods?
    Properties that contain functions.

  7. What are objects?
    An 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 information combined with a Boolean value, so basically grouped/combined values.

  9. How do you define an object?
    var ObjectName = {property1:value1, property2:value2, property3:value3};

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

  11. Why can’t you add new properties to a string variable?
    Because strings are immutable.

  12. What are rest parameters?
    They accept any number of arguments within a function.

  13. What is serialisation and what is a use case of serialisation of data?
    Converting data into a flat description.
    When saving data in a file for later or when to send it to another computer over the network, you have to somehow convert these tangles of memory addresses to a description that can be stored or sent. This can be achieved throughout serialisation.

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

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

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 problem that cannot be solved with variable types such as strings and integers would be if you wanted to store an organized collection of data with values that could be easily retrieved or modified afterwards.

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

3. What are properties in Javascript?
Properties tell us some information regarding a variable. For example, some properties could be the length of a string, or the maximum value in an array.

4. Which values do not have properties?
Most JavaScript values have properties except for null and undefined. Typing null.length to find the length of null would return an error, as null has no properties.

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

  1. value.x
    –> ex) array.length
  2. value[x]
    –> ex) array[“length”]
    (Both tell us how many elements an array has, but typically we write array.length since it’s easier to write)

6. What are methods?
A method is a function that is associated with an object property - for example, sequence.push(4) will add the value 4 to the end of the array sequence, while sequence.pop() removes the last value in the array and returns it.

Properties that contain functions are generally called methods of the value they belong to - ex) “toUpperCase is a method of a string”, and push() and pop() are methods of an array

7. What are objects?
An object is a type of value that is essentially a random collection of properties. Objects in JavaScript are collections of key-value pairs. The key is always a unique string in the collection while the value can be a primitive type (string, number, Boolean, etc), an object, or a function.

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)?
Like arrays (which are actually a specific kind of object), objects provide ways to group several values into a single value. Think of objects as a basket and that can allow you to hold several different values in one place rather than you holding on to them individually.

9. How do you define an object?
Use bracket notation { } and colons : and be sure to put commas , after each key-value pair (property). See the example below.

const today = {
temperature: 20.5,
weather: “Sunny”,
enoughSleep: true,
chores: [“dishes”, “gardening”, “made pasta”, “laundry”]
};

To access a certain property such as weather, we can type this:
console.log(today.weather);
// --> Sunny

10. What can you say about the mutability of Javascript objects?
For some value types such as numbers, strings, and Booleans, they are immutable meaning we cannot change the values of those types. We cannot take a string that contains “table” and change a character to make it spell “fable”.

On the other hand, we can change object properties and cause a single object value to have different content. This is called mutability, which means that the values contained within an object can be changed later on.

SECOND PART:

1. Why can’t you add new properties to a string variable?
Values of type string, number, and Boolean aren’t objects. You can try to set new properties on them but those properties won’t actually be stored by the computer.

2. What are rest parameters?
The rest parameter syntax lets a function accept an indefinite number of arguments as an array and is written as three dots before the function’s last parameter. Rest parameters are useful since they allow us to bundle all the extra parameters into a single array and use array methods on it such as sort, pop, unshift.

A function definition can only have one …restParameter and it must be the last parameter in the function definition, so

function abc(…one, …two, …three)

and

function abc(arg1, …arg2, arg3)

are both incorrect. A correct example would be:

function abc(arg1, arg2, …arg3)

4. What is serialisation and what is a use case of serialisation of data?
Objects and arrays are stored in the computer’s memory as sequences of bits holding the addresses of the contents, not the contents themselves. Serialization is converting data into a flat description rather than keeping it in its complex tangle of memory addresses.

Serializing data is useful if you want to send a file to another computer over the network but don’t want to send your entire computer memory along with the addresses of the values. Simply convert the thing into a binary or textual form to easily transport it over a network.

5. What is JSON?
JavaScript Object Notation - a widely used data storage and communication format on the Web. It’s often used when data is sent from a server to a web page and it is a lightweight format for storing and transporting data.
https://www.w3schools.com/whatis/whatis_json.asp

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

  1. All property names must be surrounded by double quotes
  2. Only simple data expressions are allowed, so no function calls, bindings, and no comments

JSON data:
{
“squirrel”: false,
“events”: [“work”, “touched tree”, “pizza”, “running”]
}

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

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?
  • So far we haven’t been able to store values of different types within one semantically coherent structure
  1. What variable type can be used in order to solve the problem of storing multiple values?
  • object
  1. What are properties in Javascript?
  • properties are keys that hold a reference to a values
  1. Which values do not have properties?
  • null, undefined
  1. How can we access properties in a value (two ways)?
  • via [] and . operators
  1. What are methods?
  • methods are functions that belong to a type
  1. What are objects?
  • objects provide a structure that holds a number of variables together giving them additional semantic
  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)?
  • So far we haven’t been able to store values of different types within one semantically coherent structure
  1. How do you define an object?
  • {}
  1. What can you say about the mutability of Javascript objects?
  • Some objects have it, some don’t :wink:

Second Part:

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

  • because it is immutable
  1. What are rest parameters?
  • “rest parameters” is a way to specify a function that takes any number of parameters
  1. What is serialization and what is a use case of serialization of data?
  • “serialization” means to present a chunk of data (usually object) into some form of sequential structure. That is useful when we need to write the original data into file or send it over the Internet.
  1. What is JSON?
  • JavaScript Object Notation
  1. What are the differences between JSON and the way programmers write objects in plain Javascript?
  • in JSON names of bindings must be surrounded by double quotes and only simple types 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?
    ** It introduces the need for the ability to store multipe values that are easy to access.**

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

  3. What are properties in Javascript?
    ** Properties are characteristics, or attributes ( VALUE) of an object in JS. **

  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”, or square brackets value[x]. **

  6. What are methods?
    ** Methods are properties that contains functions **

  7. What are objects?
    ** Objects are a type of Value.
    This type is an arbitrary collection of properties created 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)?
    ** Object values can be modified and can hold different datatypes. **

  9. How do you define an object?
    ** An object is defined by opening curly braces { and separate the properties using comma, } **

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

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    ** numbers, strings, and Booleans are immutable because they are not treated as objects. You can combine them and derive new values from them, but when taking specific string values, the values remain the same. **

  2. What are rest parameters?
    ** Rest parameters are an improved way to handle function parameters, allowing us to more easily handle various inputs as parameters in a function. The rest parameter allows us to represent an indefinite amount of arguments as an array.
    The rest parameter has to be the last argument because it is used to collect all of the remaining elements into an array. **

  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 is a process of converting the state of Object into flat data (bits) so that it can be transferred over network **

  5. What is JSON?
    ** JavaScript Object Notation is used for data storage and sending and receiving data over network for Web applications.**

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    ** JSON is used for simple data and cannot store functions and computation performing expressions. All the property names are surrounded by "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?
    Data type like strings and integers is not easily stored as a chunk of digital data. It is awkward to have to convert a string number into an integer and access it. JavaScript provides a data type to store sequences of values, such as an array written as a list of values between square brackets separated by commas.

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

  3. What are properties in JavaScript?
    In JavaScript properties are the elements stored in an array.

  4. Which values do not have properties?
    Undefined, and null.

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

  6. What are methods?
    Methods are properties that contain functions.

  7. What are objects?
    Objects are collections of properties enclosed in 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.)?
    Objects are used to store keyed collections of various data type and more complex entities. In JavaScript objects penetrate almost every aspect of the language. Other date types like primitive contain a single value, or string.

  9. How do you define an object?
    An object is a collection of properties ,and a property is an association between a name and a value. A property’s value can be a function, in which case the property is known as a method. In addition to objects that are predefined in the browser, you can define your own objects.

  10. What can you say about the mutability of JavaScript objects?
    Objects can have two different digits and have the same property. Objects can be changed by changing their properties using a single object value to have different content at different times.

String and their properties.

  1. Why can’t you add new properties to a string variable?
    Every string value has a number of methods which are built in properties.

  2. What are rest parameters?
    The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing way to repeat variadic functions in JavaScript. A variadic function is a function of indefinite arity ,i.e. one which accepts a variable number of arguments.

  3. What is serialization and what is a use case of serialization of data?
    The process of translating a data structure or object state into a format that can be stored or transmitted and reconstructed later.

  4. What is JSON?
    JSON is JavaScript Object Notation, a syntax for storing and exchanging data. JSON is text, written with JavaScript object notation.

  5. What are the differences between JSON and the way programmers write objects in plain JavaScript?
    The only difference is that all names in JSON must be wrapped in double quotes. All JSON data are valid JavaScript object.

2 Likes

The main problem introduced would be the inability to store and/or access multiple values in an organized and retrievable way within a single variable.

An array is a variable type which can be used to solve the problem.

Properties are traits, or characteristics, of an object in JavaScript.

The exceptions to the general rule of “all JavaScript values have properties” are null and undefined.

The two ways we can access JavaScript properties are with a “.” and with square brackets.

A method is a function within a property. An example of this would be “.toUpperCase()”.

Objects are values of arbitrary collections of properties. What this means is objects are a collection of unspecified properties.

Objects solve problems that require the ability to compare two objects relating to their identity; not only their value. This allows for mutability opposed to values being immutable.

Please reference answer 7.

The mutability of JavaScript objects are essentially what classifies an object. The ability to change a value within the object to a different value any time is what makes an object so useful.

SECOND PART:

New properties cannot be added to a string variable because strings have their own built in properties along with number and boolean. The values of these are immutable.

Rest parameters are a way of representing an array with all arguments. The notation to call is an ellipses (…) preceding the function’s name

Serialisation is the conversion of data to a flat description. This means the data is compressed into a simpler format for ease communicating said data.

JSON, or JavaScript Object Notation, is a popular serialization format used for data storage and communication on the web.

The primary differences between JSON and JavaScript are the restrictive qualities tied to JSON. This means no function calls, binding, or computations of any sort can be within the JSON file.

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? no clue
  2. What variable type can be used in order to solve the problem of storing multiple values? an array

[quote=“Elias, post:9, topic:3116”]
3. What are properties in Javascript? values defined inside an 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 and with
square brackets
6. What are methods? Properties that contain functions
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)? objects allow you to hold and change the state of as many different datatypes as you want. This cant be done with values as integer, string, array and boolean cause these are primitive values.
9. How do you define an object? data structures that are created using braces to contain a list key/value pairs separated by a comma
10. What can you say about the mutability of Javascript objects? you can change values inside the objects

SECOND PART:

  1. Why can’t you add new properties to a string variable? a sting is not an object so its immutable
  2. What are rest parameters? collects multiple elements and condenses into a single array element
  3. (Feel free to skip the sub-chapter of Math object and Destructing)
  4. What is serialisation and what is a use case of serialisation of data? the process of converting an object’s state to a string from which it can later be restored
  5. What is JSON? A popular serialization format
  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— In JSON no function calls, bindings, or
    anything that involves actual computation. Also, comments are not allowed
1 Like

1.What problems does this chapter introduce that cannot be solved with variable types such as stringer or integera’
How to store a set of numbers in the machine’s memory into digits and the backwards conversion to number so that they are accessible.

2.What variable type can be used in order to solve the problem of storing multiple values?
We can use Array, eg. Let listOfnumbers=[2,3,5,7,11];

3.What are properties in JavaScript?
Expression which access a property of some value.

4.Which values do not have proberties
The values null and undefined.

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

6.What are methods?
Methods are properties which contains function values.

7.What are objects
Objects are arbitrary collection of properties.

8.What problems do objects solve that can not be solved with other values types we’ve learned so far (such as integer, string array, Boolean etc)?
We can change their properties, what we can’t do with types of values like integer, string, array, Boolean.

9. How do you define an object ?
I give an e.g from the book: const score={visitors:0 , home: 0)};

10.What can you say about the mutability of JavaScript objects?
We can change the properties of an object an create a single object value which has a different content at different times.

Part 2

1. Why can’t you add new properties to a string variable?
Because a string value will alway remain the same (immutable).

What are rest parameters?
Function which accepts any input.

3.
Very interesting sub-chapter :grinning:

4.What is serialization and what is a use of serialization of data?
Serialization means to convert data into a flat description. In this way Data is better to store or to send because it takes less place in memory.

5.What is JSON’?
JASON (JavaScript Object Notation) is a serialization format. JSON isn’t only used in JavaScript also other languages us it for data storage and communication format on the Web.

6.What are the differences between JSON and the way programmers write objects in plain JavaScript?
In JSON property names have to be surrounded by double quotes and JSON allowed only simple data expression with no function calls and bindings. We can not make comments in JSON, in JavaScript it is allowed.

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?

The issue of utalizing large amounts of data in a simple and effective way.

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

Using an Array, we can create data sets that can be extracted easier.

What are properties in Javascript?

Properties are contents of an object

Which values do not have properties?

Null and undefined

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

With a “.” using the property name, or “[ ]” after the value to obtain the value calculated within the brackets.

What are methods?

Properties that contain functions for an object

What are objects?

Locations where properties are assigned using braces expressing keys and their 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)?

The ability to create, modify, and utilize data sets

How do you define an object?

They are defined as any other variable within the list in braces.

What can you say about the mutability of Javascript objects?

This means that their properties are able to be modified while numbers, strings, and booleans are all immutable / unchangeable.

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

A string value is immutable

What are rest parameters?

Denoted by 3 dots before the name of a functions final parameter, it is used to call the rest of the arguments.

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

Conversion of saved memory to a flat description making it more workable for sending over the web.

What is JSON?

JavaScript Object Notation, is a popular serialization format widely used as a data storage and communication format.

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

JSON requires double “ “ quotes instead of single and can only be expressed in simple expressions.

1 Like

Chapter 4

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 needing to store and subsequently sort through large amounts of data consisting of multiple values.

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

Arrays.

3. What are properties in Javascript?

Properties are the attributes/elements of values in JavaScript. In a simple case, the property of a value that is a string is its length. In a more complicated case, properties can be the elements of a value that is an object.

4. Which values do not have properties?

null and undefined.

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

exampleValue.exampleProperty, or exampleValue[“exampleProperty”]

6. What are methods?

Methods are properties that hold a function.

7. What are objects?

An object in JavaScript is a variable that contains many different values (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 allow us to hold, catalogue and sort large amounts of data in a single data type, something that is impossible to do with integers, strings, and booleans. Arrays can do this to some extent as well, but since their elements are sorted via index numbers vs string names in objects, objects offer more flexibility and potential than arrays.

9. How do you define an object?

let exampleObject = {a: property1, b: property2, c: property3};

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

JavaScript objects are mutable, unlike other value types.

Subchapter: Strings and Their Properties

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

Because they are not objects and JavaScript can’t save new properties to anything except objects.

2. What are rest parameters?

A rest parameter is a way of writing a function so that it will accept an unlimited amount of arguments in the form of an array.

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

Serialisation is the flattening down of complex data structures into strings so that they can be easily stored and sent to and from computers.

4. What is JSON?

JSON is a common serialisation format.

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

When writing an object in JSON, no syntax that involves actual computing can be used, only simple data expressions. Comments aren’t allowed as well.

1 Like
  1. It can’t save multiple elements type.

  2. We can used array which is a data type specifically for storing sequences
    of values

  3. Properties defines caracteristic of a value in a data structure

  4. Null and undefined

  5. array.color, array[“color”]

  6. Methods are function of object

  7. Objects are data structure, containing multiple properties.

  8. Objects can hold multiple data type

  9. Objects are defined by using braces

  10. It means that we can change the value contain in the object even after it’s creation.

  11. A string is a primitive type, they are immutable

  12. Rest parameters, allows us to add as many arguments that we want

  13. Serialisation is the fact of converting data stored in memory into a description of what the data is.

  14. Javascript Object Notation it’s a type of serialization used to store data and communicate on the web

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

1 Like
  1. The problem introduces is by using strings or integers is that you would have to convert them back to numbers or integers to be able to access them.

  2. An Array is a variable type that can be used in order to solve the problem of storing multiple values.

  3. Properties in JS are values associated to objects that can be added, changed, or deleted.

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

  5. To access the properties in a value you would use a dot (.) or brackets [ ].

  6. Methods are properties that contain certain functions.

  7. Objects are values given to arbitrary collections of properties.

  8. Objects allow you to group number, strings and Boolean values together, then modify them separately.

  9. An object is defined by either a literal, the keyword new, or a constructor, wrapped in curly braces and followed by a semi-colon.

  10. Mutability allows you to change the properties of the copy and original by creating a reference instead of a new item.

Strings and their properties:

  1. You cant add new properties to string variables because they are immutable.

2 Rest Parameters allow a function to accept any number of arguments.

  1. SKIP

  2. Serialisition is the process of converting an objects state to a string which can later be restored. ECMAScripts5

  3. JSON is Java Script Object Notation - is a text only syntax for storing and exchanging data.

  4. Jason has to have " " around properties, only simple data expressions are allowed, no functions, binding, computations or comments.

1 Like