Data Structures (Arrays and Objects) - Reading Assignment

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?

Creating a set of data.

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

Arrays can be used to store multiple values.

3. What are properties in Javascript?

Properties can be seen as characteristics of certain values, such as .length.

4. Which values do not have properties?

null and undefined do not have properties

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

The main ways are with a dot and with square brackets. For example, theString.length, or theString[“length”].

6. What are methods?

methods are properties that contain functions, such as .toUpperCase and .toLowerCase

7. What are objects?

objects are arbitrary collections of properties. They can be created by using braces as an expression. For example : let academy = {Ivan: true, Tech: true};

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 let us store values of many types. You could have booleans and arrays, for example, bound in the same object.

9. How do you define an object?

As you would define any variable, but the value is stored within braces.

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

As opposed to numbers, strings, and booleans, which are immutable, objects’ properties can be modified.

SECOND PART

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

Their values are immutable, they are not objects.

2. What are rest parameters?

rest parameters are used to compute all the arguments in an array.

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

Serialization means to take the data and convert it into a flat description. Serialization can be used for data storage or as a communication format on the web.

5. What is JSON?

JSON is a popular serialization format. JavaScript Object Notation.

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

JSON has restrictions. Anything that involves computation, like function calls, is not allowed. The property names have to be surrounded by double quotes.

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?
I just wanna say this caught me off guard - Every now and then, usually between 8 p.m. and 10 p.m., Jacques finds himself transforming into a small furry rodent with a bushy tail lol funny problem :smiley: Anyway I think the main point of the story revolves around the problem of storing information, specifically a string/integer in programming can only contain a single type of data. So the question how can this be solved. The proposed solution is a data structure capable of storing multiple values and different datatypes that would help keep the information organized.
2. What variable type can be used in order to solve the problem of storing multiple values?
I think arrays are one of the variable types that can store multiple values. Also objects.
3. What are properties in Javascript?
A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure. Properties can usually be changed, added, and deleted, but some are read only.
4. Which values do not have properties?
Null and undefined.
5. How can we access properties in a value (two ways)?
One way is with a dot - value.x or with square bracket value[x].
6. What are methods?
JavaScript methods are actions that can be performed on objects. A JavaScript method is a property containing a function definition.
7. What are objects?
In Javascript almost everything, except things like strings, boolean,null etc… is sort of an object. Objects contain collection of chosen properties.
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 allow us to group together many different values and also group those values back to a single value.
9. How do you define an object?
There are many ways. Short way is to first we give object a name, than we say it is equal to, then we use curly braces, Example: var car = {};
10. What can you say about the mutability of Javascript objects?
Objects are mutable structures, which mean object properties can be changed. Object state can be modified after it’s creation.

SECOND PART:

1. Why can’t you add new properties to a string variable?
Strings belong in the primitive value category thus they are immutable and cannot be changed.
2. What are rest parameters?
Rest parameters take the full array of arguments in a function. This can be done by using three dots …example: function max(…numbers) {}
3. (Feel free to skip the sub-chapter of Math object and Destructing)
Skipped (for now).
4. What is serialisation and what is a use case of serialisation of data?
Serialisation means converting data into flat description. This is mostly usefell when transfering data from one computer to another.
5. What is JSON?
JSON stands for Javascript Object Notation and it is a serialisation format that is widely used for storing data. JSON is often used when data is sent from a server to a web page.
6. What are the differences between JSON and the way programmers write objects in plain Javascript?
JSON allows only simple expressions. There are no functions, bindings, comments, computations, etc…JSON reuqire double " " quotes for all property names and not single qutoes. Javascript has built-in support for conversion between JSON and javascript object. I honestly don’t really understand JSON, but I think it is like some sort of a standard format that a lot of people use a so hopefully I can learn more about it in next chapters.

1 Like
  1. The problem introduced in this chapter is storing sequences of values. JavaScript provides a data type specifically for this, it’s called an array and is written as a list of values between square brackets, separated by commas.

  2. An array can be used to store multiple values.

  3. A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure.

  4. Null and undefined. If you try to access a property on one of these non values, you get an error.

  5. 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. The difference is in how x is interpreted.
    Dot : When using a dot, the word after the dot is the literal name of the property. Value.x fetches the property of value named “x”.
    Square Brackets : When using square brackets, the expression between the brackets is evaluated to get the property name. Value[x] tries to evaluate the expression x and uses the result, converted to a string, as the property name.

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

  7. JavaScript object is a standalone entity that holds multiple values in terms of properties and methods.

  8. Objects solve the problem of grouping together data to express a single value. Which can’t be done with the other value types.

  9. Braces or curly parentheses used as an expression is how to define an object.

  10. Objects can have their properties changed, which means a single object value can have different content at different times.

SECOND PART:

  1. Strings are immutable, if you try to set new properties on them it won’t get stored.

  2. Rest parameters allow a function to accept an indefinite number of arguments as an array. To write such a function, you put three dots before the function’s last parameter, like this:

     function max(...numbers) {
        let result = -Infinity;
        for (let number of numbers) {
           if (number > result) result = number;
        }
        return result;
     }
     console.log(max(4, 1, 9, -2));
     // → 9
    
  3. Serialization means it is converted into a flat description. A use case would be to be able to save data in a file for later or send it to another computer over the network.

  4. JSON is a popular serialization format, 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.

  5. 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. In this case, variable types such as strings or integers don’t provide the ability to store data that may be subject to change or even repeat from a day to day basis.

  2. Arrays

  3. A property is a characteristic of an object, often describing certain attributes.

  4. Nonvalues, such as null or undefined.

  5. With a dot or with square brackets.

  6. Properties that contain functions, such as toUpperCase.

  7. Objects are a collection of properties that have names and values.

  8. Those value types are immutable, whereas objects can be modified at any time.

  9. Braces are used to create objects. Inside of the braces are properties, which are separated by commas. Each property is followed by a colon and a value.

  10. You are able to change a single value within an object, giving you more flexibility within a program to store data and change it at different times unlike other variable types.

  11. They are not objects. They are immutable and can’t be changed.

  12. Rest parameters allow functions to accept an indefinite number of arguments as an array.

  13. To serialize data means to convert data into a flat description making it useful to transfer data to a file to another location on a network.

  14. JSON is used as a data storage and communication format on the web.

  15. All property names have to be surrounded by double quotes and there cannot be anything that involves any computation, such as function calls or bindings. No comments are allowed either.

1 Like

What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?

A potential option is a file system capable of storing a wide range of values and datatypes, which would help in information organisation.

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

Arrays are useful for storing many values.

What are properties in JavaScript?

Properties are characteristics of values in JavaScript.

Which values do not have properties?

The terms null and undefined do not have any properties or methods.

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

Properties in a value can be accessed using a dot and the literal name of the property.

What are methods?

Methods are attributes that contain the function values. It enables the value to be subjected to some procedure.

What are objects?

An object is a collection of properties that retain state (data) and may or may not include the Object’s behaviour (methods).

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

We can build as many Objects as we wish and describe their behaviour as needed to change their state. However, primitive types are designed to contain just data values.

How do you define an object?

An object is ideal when you wish to combine data together that is unordered and of diverse data kinds.

What can you say about the mutability of JavaScript objects?

The values of JavaScript objects can be changed by modifying their properties.

SECOND PART:

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

Because a string is not an object but a primitive type, it is immutable.

What are rest parameters?

Rest parameters are connected to an array that contains all additional arguments passed to a function.

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

To serialize data is to flatten the description of the data.

What is JSON?

JSON is a standard text-based format for encoding structured data that is based on JavaScript object syntax.

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

The main distinction is that all names in JSON must be included in double quotes. When you construct an object in JSON format, the JavaScript engine processes it the same way it would if you had used the object literal. It’s safe to assume that all JSON data is a valid JavaScript object.

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?
    Those primitive types cannot store multiple values of different types. A special type is needed which would allow to store as many primitive values/types we want in the same object.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    Tha "array’ varaible type is able to store multiple values of different types.

  3. What are properties in Javascript?
    Each type of value has its own set of properties except “null” and “undefined”. Those properties are helpers that describes the value, such as the length for a string for the type String.

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

  5. How can we access properties in a value (two ways)?
    We can access properties with a dot “.” or with brackets “[]”.

  6. What are methods?
    Methods are properties that are functions. Those functions can be called with “()” and use the value.

  7. What are objects?
    Objects are special data structure that allows to define an arbitrary collections of the properties. Braces has to be used to define them.

  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)?
    We can customize all the properties we want, any types, any value, unlimited number of properties.

  9. How do you define an object?
    We define an object using braces “{}”.

  10. What can you say about the mutability of Javascript objects?
    Values of objects can be changed unlike the primitive types.

SECOND PART

  1. Why can’t you add new properties to a string variable?
    A primitive type like string cannot be changed, only Object can be.

  2. What are rest parameters?
    Rest parameters allows to add infinite arguments to a function. You just have to put three dots before the arguments name to enable it. The type of of this special argument is 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?
    Serialization allows to transform a memory version of an object to a flat description of it. For that, we usually employ the JSON format which can be stored on hard drives or even sent throught TCP net networks, the mimi type is recognized by HTTP protocol.

  5. What is JSON?
    JavaScript Object Notation, this is serialization data format very popular but other exists like XML or YAML for example.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    Only simple expressions are allowed in JSON. There are no functions, bindings, comments, or computations.

2 Likes
  1. The issue introduced in this chapter describes the challenge of storing and analyzing a complex set of data. The data analysis requires data to be grouped together in specific categories, yet each data point must remain a separate value as well. To make things more challenging, different types of data are coming together in this data analysis. Running this analysis could probably be done using string and integer data only, but this would be very cumbersome and inefficient, because many steps of data conversion, separation, grouping, etc. would require many lines of code. Instead, objects are introduced as a construct that fulfills all the requirements to make this analysis easier and smoother.

  2. Object

  3. In JavaScript, a property is a characteristic of a value. Primitive values, for example strings or numbers, do have properties as well as values of the type object. With regard to objects, a property is a key-value (name-value) pair and part of an object. The property name is of the data type string, the value can be primitive, a method or an object reference.

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

  5. objectName.propertyName
    objectName[“propertyName”]

  6. Methods are properties that contain a function, meaning they are actions that can be performed on objects. A method is invoked with “()”.

  7. An object is a collection of named values, called properties. It is a container for a list of key-value pairs and thus makes it possible to group multiple values together in one construct. An object can hold values of different data type.

  8. An object can hold values of different data types in one construct. An object can hold and group values, which makes it possible to store large and complex data sets in an object. Furthermore, properties of an object are mutable, they can be deleted, new ones can be added and many properties can be renamed. These tasks are unfeasible or, in some cases, even impossible to perform with primitive values. Although an array, being a special type of object, can also perform many of these tasks, a traditional object in JavaScript is still more flexible and is thus more versatile than an array and it can be used in a larger range of applications.

  9. One possibility how objects can be defined is using the object literal – they are defined just like a variable but the object body is wrapped in curly brackets, each key-value pair is separated by a colon (the key is separated from the value), and the properties are separated by commas.

  10. Properties of an object are mutable, they can be deleted, new ones can be added and many properties (e.g. those that are not pre-defined methods) can be renamed. This means that objects themselves are also mutable.

Part Two

  1. String is a primitive data type and thus it is immutable, which means no new properties can be added.

  2. A rest parameter allows to represent an indefinite number of arguments as an array. The rest parameter provides a lot of flexibility with regard to the number of arguments that are to be used in an application, as this number is not fixed under the rest parameter.

  3. No question

  4. Serialization is the process of converting a data structure or object into a format that can be stored or transmitted and later be recovered back into its original format. Data serialization is used when complex data structures are converted into byte strings in order to store the data in a file or sent it to another device, where it can be converted back into its original format.

  5. JSON is a file format used for data serialization in JavaScript and other programming languages. JSON is used to convert objects into strings, which is necessary to store or transmit objects, and convert them back into objects later.

  6. JSON has specific restrictions concerning what kind of data is acceptable. In JSON, all property names must be surrounded by double quotes and only simple data expressions are allowed (no function calls, bindings, or any computation).

2 Likes

1.Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
Strings and integers are not easily stored as a chunk of digital data. There is two types of accessing properties in JavaScript. We have to create a data first.

2.What variable type can be used in order to solve the problem of storing multiple values?
Value is in square brackets: Value[x] (instead of value.x).

3.What are properties in Javascript?
Properties are characteristic of certain value, example: myString.length (get the length of a string).

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 -> works only with names that look like valid binding names (example: value.color)
-With square brackets: value[x] -> works for any property name (example: value[2] or value[’‘John Doe’’])

6.What are methods?
Methods are functions that live in properties and (usually) act on the value they are a property of.

7.What are objects?
Those are values-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)?
You can store more values and properties in one single objects, what you can not do with other value types as mentioned.

9.How do you define an object?
Object is defined inside the braces, where is a list of properties separated by commas. Each property has a name followed by a colon and a value.

10.What can you say about the mutability of Javascript objects?
If for example object 1 and object 2 contains the same property, they not have the same identity.
Property or content of specific object can be changed by rewriting to new content.

SECOND PART:

1.Why can’t you add new properties to a string variable?
String is not an object. Those values are immutable and can not be changed.

2.What are rest parameters?
Rest parameters in called function are all parameters of given array.

4.What is serialisation and what is a use case of serialisation of data?
It is conversion of data of memory addresses in binary form to a form (flat description) that can be stored or sent to another computer.

5.What is JSON?
Is a popular serialization format which stands for J ava S cript O bject N ation. 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?
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.) It needs a structured system that can store multiple values in a variable.
2.) The Array type.
3.) Each object in javascript got properties except Nonvalues. As an example we got the .length property, its used to tell us about the size.
4.)Nonvalues like “null” and “undefined” got none…
5.) With a dot(.) or these [ ] brackets.
6.)Properties that stores functions are called “methods”.
7.) Objects are variables that can store many values.
8.) It can store multiple datas and functions.
9.) An Object is a standalone entity with mulitple properties and methods in it. It is like an octopus with names tattoed on its tentacles labeled with numbers.
10.) In Javascript the properties ob objects can be changed… so objects are mutable.

Second Part

1.) String Variables are immutable… When you try to add another value to a string variable, it doesnt add it, it cuts the binding from the old and makes a new binding.
2.)With the rest parameter syntax you can add any more parameters as an array. You can call it with three dots (…) before the last parameter in a function.
3.) Skippo
4.) Serialisation is like translating data in a format that can be stored in data buffer or transmitted over a network and gets than reconstructed there.
5.)JSON is a popular serialization Format. (Javascript Object Notation)
6.)Json Objects are written with " ". In Javascript Objects the keys are not wrapped with " " .

1 Like

PART ONE:

  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 keeping a daily log of things Jacques does. This cannot be solved with strings because he’d have to extract the digits in the string and covert them to number.

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

Arrays are used to store multiple values for variables.

  1. What are properties in JavaScript?

Properties are values connected to JavaScript objects.

  1. Which values do not have properties?

“Undefined” and “null” are the only JavaScript values that have no properties.

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

Properties can be accessed with a dot (value.a) or with square brackets (value[a]).

  1. What are methods?

Methods are properties that contain function values.

  1. What are objects?

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

Objects are useful for storing a list of properties followed by a Boolean value.

  1. How do you define an object?

To define an object, one must write a variable followed by curly braces. Within the curly braces, store a property followed by a colon and its value then type a comma and move on to as many properties as one need to finish the object.

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

Object properties are mutable since one can change an object value to have different content at different times in a file of code.

PART TWO:

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

String variables are not objects and therefore cannot store properties even if one tried to set properties on them.

  1. What are rest parameters?

Rest parameters are a three dot notation (…) that are bound to an array containing all further arguments. They are used to spread out arrays for further usage in latter parts of one’s code.

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

Data serialization is when structured data is converted in a form that can be stored and reconstructed for later usage. A use case of serialization of data is JSON.

  1. What is JSON?

JSON stands for JavaScript Object Notation and is used for data serialization, storing data and transferring it for further usage later on.

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

In JSON, property names have to have double quotes and only simple data expressions are allowed. There are no function calls, bindings or comments among other things.

1 Like

1)The challenge with using variable types such as strings and integers is that it is immutable.
The person is looking for what makes him turn into a squirrel between 8 and 10 pm.
2) Arrays and objects.
3) Almost all JavaScript values have properties except null and undefined.
4) Null and Undefined
5) Properties in a valus can be accessed using a dot and the literal name of the property and
by using square brackets with the expression between the brackets being evaluated to get the property name.
6)Methods are properties that hold function values. These specialty functions only work on the value they belong to.
7) Objects are data stuctures that are capable of containing an arbitrary collection of properties. These are created using braces to contain a list key/value pairs seperated by a comma.
8) Objects are special because they are to hold as many different datatypes as we need.
9) Objects are defined as any other variable, with the value being a list contained within braces.
10) The mutability of JavaScript objects means that the values they contain can be chaged.

Part 2

  1. A string is not an object but a primitive type and they are immutable.

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

3)Serialisation is converting data stored in memory into a flat description of what the data is. It is useful for when we want to do things like saving data to a file or transferring it to another computer on a network.

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

  2. All property names need to be surrounded in double quotes and only simple data expressions are allowed. No function calls, bindings, and anything that involves actual computation.

2 Likes
  1. The subchapter weresquirrel introduces the idea of having multiple properties connected to the same value but still being able to reference individual properties that are stored without having to store them all in a string or number type that would be difficult to work with.
  2. Arrays can be used to solve this problem.
  3. Properties in JavaScript are some piece of information about a value that is connected to it much like myString.length gives the length property of the myString value.
  4. Null and undefined do not have properties.
    5.You can access properties through the dot function like math.max or square brackets like value[x].
  5. Methods are properties that contain functions.
    7.Objects are arbitrary collections of properties.
  6. Objects can attach multiple properties to a single value all while making them easy to reference and use. Arrays are close but in reality arrays are a specific type of object that excels at storing sequences of things.
  7. An object is like a tether that holds onto different properties for you about a specific object so they are ordered and stored nicely for use later. This also prevents them from being overwritten later in your code accidentally.
    10, Object values can always be changed or appended were as strings, boolians, and integers are immutable, meaning they can only be stored and called not edited.

Second Part

  1. String values cannot have new properties added to them because they are immutable and have pre determined properties like index and length that are built into JavaScript.
  2. Rest parameters are a way of telling the code to include all elements of some array such as function max(…numbers) takes the max of all numbers included in the array “numbers”.
  3. COOL
  4. Serialization is the conversion of data to a flat description that only includes the data included in the code which saves space and makes the file more lightweight.
  5. JSON is the standard serialization format that we use for data storage and communication. JSON stands for JavaScript Object Notation
  6. The differences between the way objects are written in plain JavaScript and JSON is that all property names have to be surrounded by double quotes and only simple data expressions are allowed. This means no function calls, bindings, or anything else that involves computation.
1 Like

FIRST PART

  1. We want to store a number of activities for every day.
  2. Arrays
  3. Values of Javascript objects that define some characteristic features of he object.
  4. Null and undefined
  5. By putting a dot after the object’s name and before the property (e.g. myArray.length) or by using square brackets (e.g. myArray[“length”] )
  6. Properties, that hold function values.
  7. Data structures, that can store collections of properties.
  8. Objects are capable of storing multiple, different type of values at the same time.
  9. You start with let or var, then give a name to the object. After, you can write the properties between brackets. Between every property name and its properties, there’s a colon, and between property name - property pairs, you put commas.
  10. You can change property values.

SECOND PART

  1. Strings cannot be changed after declaration.
  2. It allows a function to accept multiple arguments as an array.
  3. It is the method of “converting the data into a flat description” which basically means converting it into a simple format to use it somehow. One use case is JSON.
  4. A data format, very similar to a javascript object, that is mostly used to store and send data on the internet.
  5. In JSON you have to put everything between double quotes and you can only use simple data expressions.
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 chapters demands usage of variable, that will contain several values of different types at once.

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

  3. What are properties in Javascript?
    Properties are values connected to JS object.

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

  5. How can we access properties in a value (two ways)?
    directly through “value.x” - if x is the direct name of the value. Or we can do it through “value[x]”, which means we first have to evaluate x and then acess the value. (for example, when x = color)

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

  7. What are objects?

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

  9. How do you define an object?
    Object is a value, that contains arbitrary amount of properties/methods.

  10. What can you say about the mutability of Javascript objects?
    Javascript objects are immutable, unless you define them to be the same object.
    If you have two different objects with same properties, they are still immutable, because they have different identity. Only way for 2 objects to be mutable is by defining Object1 = Object2.

  11. Why can’t you add new properties to a string variable?
    Because String is not an object. Those values are immutable and can´t be changed.

  12. What are rest parameters?
    Rest parameter is a parameter that contains indefinite amount of arguments as an array. It used often when you don´t know in advancew, how many arguments you will be using to call your function. (Max for example)

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

  14. What is serialisation and what is a use case of serialisation of data?
    Converting data into flat description. Use case is: If we want to send our data over the network, we would have to send our entire PC memory with all grasps and bindings and adresses.

  15. What is JSON?
    JSON stands for JavaScript Object Notation - it is a standartized serialization format your data. It is widely used for data storage and communication on the web.

  16. What are the differences between JSON and the way programmers write objects in plain Javascript?
    It has a few restrictions. Namely:
    All property names must be surrounded by double quotes and only simple data expressions are allowed.( No function calls, bindings or any 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?
    If we want to work with a chunk of digital data we need to find a way to store or represent a collection of numbers - we are using an array!
  2. What variable type can be used in order to solve the problem of storing multiple values?
    Arrays can be used for this task.
  3. What are properties in Javascript?
    They are like expressions that access a property of some value.
  4. Which values do not have properties?
    null and undefined do not have them.
  5. How can we access properties in a value (two ways)?
    We can access them by either using the dot or the square brackets.
  6. What are methods?
    So properties that contain functions are called methods.
  7. What are objects?
    Values of the type object are 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 solve the problem of not being able to store mutliple, different type of values at the same time.
  9. How do you define an object?
    First you define an object and then you can write the propertie names with their properties inside the braces. They are separated by colons and commas.
  10. What can you say about the mutability of Javascript objects?
    Numbers, strings and booleans are all immutable so it’s not possible to change the values. In contrast to this, you’re able to change the properties of objects.

On to the second part :slight_smile:

  1. Why can’t you add new properties to a string variable?
    Because they are immutable and cannot be changed.
  2. What are rest parameters?
    They are useful for a function accepting any number of arguments.
  3. What is serialisation and what is a use case of serialisation of data?
    By serialising data we can convert data into flat description.
  4. What is JSON?
    JSON is a popular serialisation program which stands for JavaScript Object Notation.
  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    In JSON we have double quotes and there are only simple data expressions allowed.
1 Like

Sub-chapter: The weresquirrel

A.1. This chapter introduces the need for data log to store information. In the weresquirrel example provided, Jacques needs to create a daily log of events that makes him change into a weresquirrel.

A.2. Let—is the variable type to be used in order to solve the problem of storing multiple values by implementing an array. Array is written as a list of values between square brackets, separated by commas. Array is a zero-based counting. As for the example below the index zero points to the number 2, index 1 points to the number 3, etc. For example:

let listOfNumbers = [2, 3, 5, 7, 11];
console.log (listOfNumbers [0]);
// → 2
console.log (listOfNumbers [1]);
// → 3
console.log (listOfNumbers [2 - 1]);
// → 3

A.3. In JavaScript property is a valid biding name.

A.4. Null and undefined are values that do not have properties.

A.5. Properties can be accessed by introducing a dot or square brackets i.e. array.length or array[“length”]. When using a dot, the word after the dot is the property name. When using square brackets, the word in brackets is the property name. Besides length, other valid biding names are for example: max, math, value, push, pop, etc.

A.6. Methods are properties that contain functions. For example:

let sequence = [1, 2, 3];
sequence.push (4);
sequence.push (5);
console.log (sequence);
// → [1, 2, 3, 4, 5]

A.7. Objects are collections of properties.

A.8. Properties allow the formation of groups into a single value and put those values into an array of log entries. Properties have a name followed by a colon and a value. For example:

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

A.9. Objects are defined or written by using braces as an expression. For example:

let descriptions = {work: “Went to work”, touched tree: “Touched a tree”};

NOTE: ( ) parenthesis; [ ] brackets; { } braces

A10. The mutability of Javascript objects allow properties to be changed causing a single object value to point to different content at different times. For example, two numbers 120 and 120 although they are the same number they may not refer to the same physical bits. There is a difference between having two references to the same object and having two different objects that contain the same properties. For example:

let object1 = {value: 10};
let object2 = object1;
let object3 = {value: 10};

Changes to object1 will reflect on object2 but object3 is independent from object1 and object2 although they hold the same value, temporarily.

Sub-chapter: Strings and their properties

A.1. New properties cannot be added to a string variable because it is not an object and therefore it is immutable. Besides, string variables, values type number and Boolean are also not objects. Again, such values are immutable and cannot be changed.

A.2. Rest parameters are functions that accept any number of arguments. Such function is defined by three dots before the function’s last parameter. For example:

let words = [“never”, “fully”];
console.log ([“will”, …words, “understand”]);
// → [“will”, “never”, “fully”, “understand”]

A.3. N/A

A.4. Serialisation allows data to be converted into a flat description such as JSON format. Serialisation also allows data storage and communication on the web.

A.5. JSON is a web data format. It stands for JavaScript Object Notation.

A.6. JSON looks somehow similar to JavaScript’s way of writing arrays and objects. All property names are between double quotes and only simple data expressions are allowed—no functions calls, bindings or anything involving computation. Comments are also not allowed in JSON.

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?
    Problem of storing different data types (values) together. a regular binding hold one value of one kind and sometime it doesn’t solve the problem.

  2. What variable type can be used in order to solve the problem of storing multiple values?
    Objects and Arrays can be used to store multiple values together under one binding.

  3. What are properties in Javascript?
    Properties are characteristic of values attach to them. properties are used to get maximum out of the value.

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

  5. How can we access properties in a value (two ways)?
    you can access properties
    1.by using its name ie. mystring.length
    2.by using its an expression or name in square bracket.

  6. What are methods?
    methods are properties attach to the values. ie. pop() is a method for bindings with value of array.

  7. What are objects?
    Objects are collection of values or objects.

  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    objects can hold different data types so we can create complex program and data structures.

  9. How do you define an object?
    Objects are complex entity with vast possibilities. they can hold different data types within.
    Objects are custom datatypes. they allow you to create your own datatypes as per your need.

  10. What can you say about the mutability of Javascript objects?
    it means that values hold by object can be changed, you can add or remove different values in it. This is different to other datatypes such as strings, which will always keep the same value it was defined with which is string.

Second part… tomorrow.

2 Likes

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    There are 6 language types in JavaScript:
  • 5 primitive types: String , Number , Boolean , Null , Undefined
  • 1 non-primitive type: Object

Values of the primitive types are called primitive values and they cannot have properties.
Values of the Object non-primitive type are called objects and they can have properties.

  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.

The difference between rest parameters and the arguments object

There are three main differences between rest parameters and the arguments object:

  • The arguments object is not a real array , while rest parameters are Array instances, meaning methods like sort , map , forEach or pop can be applied on it directly;
  • The arguments object has additional functionality specific to itself (like the callee property).
  • The ...restParam bundles all the extra parameters into a single array, therefore it does not contain any named argument defined before the ...restParam . Whereas the arguments object contains all of the parameters – including all of the stuff in the ...restParam – un bundled.
  1. What is serialisation and what is a use case of serialisation of data?
    Serialization is the process of converting some in-memory object to another format that could be used to either store in a file or sent over the network. Deserialization is the inverse process meaning the actual object instance is restored from the given serialized representation of the object. This is very useful when communicating between various systems.

Serialization can become handy if you need to store complete structures (like an invoice with all associated data like customer address, sender address, product positions, tax caclulcations etc) that are only valid at a certain point in time.

All these data will change in the future, new tax regulations might come, the address of a customer changes, products go out of life. But still the invoice needs to be valid and stored.

This is possible with serialization. Like a snapshot. The object in memory are serialized into a (often like in PHP) binary form that can be just stored. It can be brought back to live later on (and in a different context). Like with this invoice example: In ten years, the data can still be read and the invoice object is the same as it was ten years earlier.

  1. What is JSON?
  • JSON stands for J ava S cript O bject N otation
  • JSON is a lightweight data-interchange format
  • JSON is plain text written in JavaScript object notation
  • JSON is used to send data between computers
  • JSON is language independent
  1. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JavaScript object defined by using Object Literal Notation while JSON is a textual , language-independent data-exchange format, much like XML, CSV or YAML. The JSON spec is a syntax for encoding data as a string. you cannot do much with JSON.
1 Like

Excellent answers @hinazahoor. :clap:

Please keep this enthusiasm and zeal for studying. You’re going in the right path!

Have a wonderful day. :slight_smile:

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?
This chapter introduce problems of storing different types together in one variable.
2. What variable type can be used in order to solve the problem of storing multiple values?
Variable type that can be used is an array.
3. What are properties in Javascript?
Properties in JavaScript are expressions that access a property of some value.
4. Which values do not have properties?
Values that do not have properties are null and undefined.
5. How can we access properties in a value (two ways)?
The two main ways to access properties in JavaScript are with a dot and with square brackets.
6. What are methods?
Methods are properties that contain functions.
7. What are objects?
Objects are arbitrary collections of properties.
8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
Objects can store multiple datatypes.
9. How do you define an object?
An object is defined by using braces as an expression. Inside the braces, there is a list of properties separated by commas.
10. What can you say about the mutability of Javascript objects?
JavaScript objects are mutable, their properties can be changed, causing a single object value to have different content at different times.

SECOND PART:

1. Why can’t you add new properties to a string variable?
String variables are immutable and cannot be changed.
2. What are rest parameters?
Rest parameters are bound to an array containing all further arguments.
3. (Feel free to skip the sub-chapter of Math object and Destructing)
4. What is serialisation and what is a use case of serialisation of data?
Serialization is converting data stored in memory into a flat description. Use case of serialization of data is saving data in a file for later or sending it to another computer over the network.
5. What is JSON?
JSON (JavaScript Object Notation) is a popular serialization format. It is widely used as a data storage and communication format on the Web, even in languages other than JavaScript.
6. 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 and comments are not allowed.

1 Like