Data Structures (Arrays and Objects) - Reading Assignment

  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?

The need to store multiple variable types (values) within a single variable

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

We can use arrays to store multiple values and access them as they are.

  1. What are properties in Javascript?

They are certain characteristics of a value in Javascript.

  1. Which values do not have properties?

Null and undefined

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

Value.x or value[“x”]

  1. What are methods?

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

  1. What are objects?

An arbitrary collection of properties

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

They can store sequences of things. Basically they can store several types of data inside one object

  1. How do you define an object?

Using curly brackets in an expression then inside the bracket { state a name of a property then a colon : then give it a value then a comma , and state the next name then colon : value etc. etc then close curly bracket }

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

Unlike numbers, strings and Booleans (which are immutable) objects have mutability (can be changed) and have different content at different times.

Now you’ve probably come to the sub-chapter called The lycanthrope’s log. Skip this chapter if you want as it for some reason introduces a lot of math which is completely unnecessary at this point.So feel free to jump to the sub-chapter called Strings and their properties.

Think about the following questions:

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

Because they are immutable (unlike objects which can be added to)

  1. What are rest parameters?

They can only go at the end (must be the last parameter in a function’s definition) and a rest parameter tells Javascript to place all the remaining parameter (that the programmer gave it) in a standard array. This allows them to be used in succession without having to individually list them all.

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

When we convert our data to a flat description. For instance if i wanted to send

  1. What is JSON?

JavaScript Object Notation - data storage and communication format on the web (even used in other languages beyond javascript)

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

In JSON there are no function call, bindings or anything that requires computation allowed and it must be written with “ double quotes not single ‘ .

You use JSON.stringify(JavaScript String) to turn a regular JAvaScript value into a JSON-encoded string

You use JSON.parse(string) to convert back to the value you encoded with the .stringify command

1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?

sorting data

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

arrays

  1. What are properties in Javascript?

subcategories of all values

  1. Which values do not have properties?

null and undefined

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

[] get’s name and . gets value

  1. What are methods?

properties that contain methods

  1. What are objects?

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

storing different types of variables

  1. How do you define an object?

nameofobject = {}

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

strings numbers and bool are all immutible, meaning their values are fixed, while objects can have different values at different times

SECOND PART:

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

strings are immutable and their properties are fixed

  1. What are rest parameters?

allows you to pass any number of arguments to the function

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

too late I’ve gone over it

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

it is to process of translating a data structure or object state into a formark that can be stored or transmitted and reconstructed later.it is advantages because this data can now be encrypted, authenticated and compressed

  1. What is JSON?

Javascript and some other langauges use this as an object library or rather properties?

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

Json property names must have “”, only simple data expressions are allowed, and comments are not allowed

1 Like
  1. Strings and integers do not allow storage of more than a single type of data and what we need is a way to store more values of different datatypes.

  2. Arrays

  3. Properties are the details of a certain value in Javascript. Most JS values have properties.

  4. Undefined and null

  5. Either with a dot and the property name ( string.length) or with brackets (string[“length”])

  6. Methods are JS properties that hold a function inside.

  7. Data structures capable of storing collection of properties and methods. Defined by a binding and with content inside {} brackets.

  8. They can hold different kinds of datatypes.

  9. Like any other variable type. We use a binding name and {} brackets.

  10. The mutability of javascript objects is the possibility of changing the values of the object’s content. Something which is usually not doable with other datypes like strings.

Second part

  1. Strings are immutable. They are not objects!

  2. Rest parameters are a way to take an indefinite amount as an argument for our function. When the function is called, the rest parameter is bound to an array containing all further arguments.

  3. converting data into a raw description of what that data is. Useful when we have to send that data to other devices.

  4. Javascript Object Notation, a popular serialisation format.

  5. No comments, No computing (bindings, functions etc) and property names 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?

Building a data structure that groups values such as strings or integers together, to represent daily logs.

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

An array.

  1. What are properties in Javascript?

The different properties are different characteristics of values.

  1. Which values do not have properties?

Null and undefined.

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

With a dot (value.x) or with brackets (value[x]).

  1. What are methods?

Methods are properties that contain functions.

  1. What are objects?

Objects are arbitrary collections of properties.

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

Objects let us group different types of values (like for example booleans, strings and integers) all together into a single value.

  1. How do you define an object?

I would define an object as a tool we use to group a number of different types of values together in JS. These values inside of an object are then properties of this object.

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

The properties of JS objects are mutable, meaning that a single object value can have different content at different times. Other types of values like numbers, strings and Booleans are all immutable.

SECOND PART

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

Because JS won’t store those properties.

  1. What are rest parameters?

The rest parameter is a syntax in JS that allows a function to accept an indefinite number of arguments as an array. The function definition’s last parameter will be prefixed with “…”, which will cause all remaining (user supplied) parameters to be placed within a “standard” JavaScript array. Only the last parameter in a function definition can be a rest parameter.

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

Serialisation is the encoding of an object or a data structure into a different format. It’s used to store that data in a file or to transmit it across a network.

  1. What is JSON?

JavaScript Object Notation (JSON) is an open standard file format, a data format that is used to serialise data.

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

It’s pretty similar, JSON having just a few restrictions:
In JSON format, all property names are written in between double quotes, and only simple data expressions are allowed - no function calls, bindings, or anything that involves actual computation. Comments are not allowed either.

1 Like

1.Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?

The problem of storing multiple values.

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

An array.

3.What are properties in Javascript?

Allmost all Javascript values have properties or somekind of functions.

4.Which values do not have properties?

null and undefined give you error.

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

With a dot and with a square brackets.

6.What are methods?

The push method and the pop method.

7.What are objects?

Values of the type object are arbitrary collections of properties.

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

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

9.How do you define an object?

You evaluate typeof [] , it produces “object” .

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

When you compare objects with JavaScript’s == operator, it compares by identity: it will produce true only if both objects are precisely the same value.
Comparing different objects will return false , even if they have identical properties. There is no “deep” comparison operation built into JavaScript, which compares objects by contents, so is possible to write it yourself.a function to accept any number of arguments

Strings and their properties.

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

They don’t stick to a string variable.

2.What are rest parameters?

They can be useful for function to accept any number of arguments. When such a function is called, the rest parameter is bound to an array containing all further arguments.

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

Freely skipping.

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

It’s converting data into a flat description. It is widely used as a data storage and communication format on the Web.

5.What is JSON?

“Jason” Javascript Object Notation is popular serialization format language.

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

JSON looks similar to JavaScript’s way of writing arrays and objects, with a few restrictions like 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?

An object helps us to collect data of different types and bind them into an “object-variable”. In that way we can store data of different types that relate to each other and have them in a nice and tidy format.

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

Arrays and objects.

  1. What are properties in Javascript?

Properties are attached to data that further define the value.

  1. Which values do not have properties?

Null, Undefined

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

By using the (.) operator or the [] brackets operator

  1. What are methods?

functions attached to values. These functions only work for the value they are attached to.

  1. What are objects?

Objects are like a container, namley a variable, that is capable of holding different data types.

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

Storing different data types inside the same variable.

  1. How do you define an object?

use the {} when initializing the variable: var ThisBoxContainsMultipleDifferentVars = {ThisIsANumber, ThisIsAString, ThisIsABoolean, YetAnotherNumber, GimmeMoreSTrings, ILoveBooleans}

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

JavaScript allows us to change the datatype of values inside the object. So if a starts out to be a number, it can be changed to string or boolean during computation.

Think about the following questions:

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

A string is a single data type that is intended to do what It says - holding a string. Only in objects we can change datatypes of contained variables.

  1. What are rest parameters?

Rest parameters come in handy when a function can contain as many arguments as input as the user wishes. For example the Math.min function can compare as many numbers as one wishes. To introduce rest parameters put (…) before the last argument like this:
function max(...numbers)

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

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

Serialization takes the stored data from the computer’s memory and transforms it into a format that is more convenient to transfer.

  1. What is JSON?

JavaScriptObjectNotation helps to send and retrieve data in a convenient format.

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

JSON objects only understand data types integers, boolean and string. JavaScript will then allow us to parse or stringify the data delivered through 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?
  • We need a connection of series that can organise multiple variables. Because strings or integers can only able to contain single types of data.
  1. What variable type can be used in order to solve the problem of storing multiple values?
  • Arrays can store multiple values
  1. What are properties in JavaScript?
  • Properties is a JavaScript that characteries a values or elements in the structures.
  1. Which values do not have properties?
  • Null and undefined
  1. How can we access properties in a value (two ways)?
  • Value.x and value [x]
  1. What are methods?
  • Methods are properties that contain function of values that belong to, such example of as in “toUppercase is a method of a string”.
  1. What are objects?
  • Are arbitrary collections of properties. One way to create an object is by using braces as an expression.
  1. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
  • It can store values in different types.
  1. How do you define an object?
  • let anObject = {value…, value…};
  1. What can you say about the mutability of Javascript objects?
  • The object values can be modified which can change their properties, causing a single object value to have different content at different times.

Now you’ve probably come to the sub-chapter called The lycanthrope’s log. Skip this chapter if you want as it for some reason introduces a lot of math which is completely unnecessary at this point.So feel free to jump to the sub-chapter called Strings and their properties .

Think about the following questions:

  1. Why can’t you add new properties to a string variable?
  • Values of type string, number, and Boolean are not objects, such values are immutable and cannot be changed.
  1. What are rest parameters?
  • Rest parameters is useful for a function to accept any number of arguments.
  1. (Feel free to skip the sub-chapter of Math object and Destructing)
  2. What is serialisation and what is a use case of serialisation of data?
  • Converted into a flat description. It is widely used as a data storage and communication format on the Web, even in languages other than JavaScript.
  1. What is JSON?
  • JSON looks similar to JavaScript’s way of writing arrays and objects, with a few restrictions.
  1. What are the differences between JSON and the way programmers write objects in plain Javascript?
  • All property names have to be surrounded by double quotes, and only simple data expressions are allowed—no function calls, bindings, or anything that involves actual computation. Comments are not allowed in JSON.
1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    Jacques needs a more complex way to store and process information. The data structure of Objects would allow him to store several values in one place and also in order to log daily information he needs a mutable function, which strings and integers are not.

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

  3. What are properties in Javascript?
    Properties are the definition of an Object.

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

  5. How can we access properties in a value (two ways)?
    Through methods, written in either dot notation (objectname.propertyname) or bracket notation (objectname […]).

  6. What are methods?
    Methods are functions within an Object.

  7. What are objects?
    An Object is basically a variable which can contain several property/value pairs and functions.

  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)?
    String, integer etc are primitive data types and their values contain only one thing.
    Objects on the other hand can contain various data, collection of values.

  9. How do you define an object?
    Through the properties, which are arranged in curly brackets. Every key : value pair is seperated by comma. If a property has several values they can be displayed in Arrays.

  10. What can you say about the mutability of Javascript objects?
    By using methods you can change an objects properties

1 Like

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Because the language wouldn’t store new value in a string variable. Whereas if you would wrap the value in curly brackets and allocate a property the language would recognize it as an object.

  2. What are rest parameters?
    Rest parameter allow a function to accept an indefinite number of arguments. You can also use it in a function call to target all values in an array.

    It’s a three dot notation followed by an argument.

  3. What is serialisation and what is a use case of serialisation of data?
    Serialisation is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database or a file.

  4. What is JSON?
    JSON is a popular serialisation format which is used as data storage and communication format, understood by other programming languages.

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    All properties are written in double quotes.

1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?

To solve the problems we need to add a list of activities per day, and we need to iterate between them.
Therefore we need to store multiple values in a collection.

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

Arrays can be used to store multiple values.

  1. What are properties in Javascript?

properties are value’s additional characteristics, such as length, capitalization, index…

  1. Which values do not have properties?

Undefined and null have no properties.

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

we can access a value using "."or using the square brackets [ ]

  1. What are methods?

A method is a type of property which hold a function.

  1. What are objects?

objects are values with a collection 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 can hold different values.

  1. How do you define an object?

you define an object using { }

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

Objects are mutable. Properties can be changed after the object has been created .


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

A string variable is not an object therefore if we try to store a new property those are not stored

  1. What are rest parameters?

rest parameters allow a function to accept any number of arguments.

SKIP

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

Serialisation is used in case we need to transfer the code to another computer or online so we will not have the same data stored. With serialization we write all the data in a function as a description.

  1. What is JSON?

Javascript object notations, is a kind of notation to export properties and values in a java script file which can be loaded later instead of coding again all the values and properties manually.

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

On Json every object need to be written with 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?

A combination of multiple strings and a binary state that must be associated in order to analyze for correlation.

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

Array

  1. What are properties in Javascript?

Values associated with an object.

  1. Which values do not have properties?

null and undefined

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

value.property or value[property]

  1. What are methods?

Methods are properties that hold function values

  1. What are objects?

Arbitrary collections of properties as defined by the programmer using key/value pairs.

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

Association of otherwise unrelated data, possibly making use of various data types.

  1. How do you define an object?

With a let command and curly brackets, with comma delimiters.

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

Objects are mutable, the values can be changed.

SECOND PART:

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

It’s got a standard set of properties, it’s not a full object with configurable property definitions.

  1. What are rest parameters?

Parameters that can accommodate an unknown number of arguments.

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

Serialization is setting out a static list of existing key/value pairs, for exporting a snapshot of data relationships at a specific instance of time.

  1. What is JSON?

JSON is a serialization output in a specific format so it can be retrieved by other system over an api or exported to a static file for later inclusion in a data set.

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

JSON has some form limitations (IE double quotes rather than single quote tolerations), and the data must be simply the final data points, there is no possibility of referencing functions, nesting calls etc. IE all references in the code must be resolved to their final data points and set out explicitly.

1 Like

One thing I didn’t quite understand here is the concept of ‘mutability’. If a string is immutable, then why can we change it?

IE string=“strong” followed by string=“bow” means it was changed from “strong” to “bow”.

Immutability in Blockchain means that once something is created it can’t be altered at all. I take it immutability in this instance means we can’t arbitrarily alter the properties of the string?

If so it’s an unfortunate confluence of language that bears noting.

1 Like

Another question: in the “Objects in Javascript” video, Ivan demonstrates an object definition that outputs to console as follows:

 var carObject = {manufacturer:"Volvo", year:2009, distance:1000};
      console.log(carObject);

When I do that, I do see the full carObject in the console log, like this:

{manufacturer: "Volvo", year: 2009, distance: 1000}
distance: 1000
manufacturer: "Volvo"
year: 2009

However, I changed it to:

` document.write(carObject);`

And received the following on the webpage:

[object Object]

Anyone know why this is so?

Yes absolutely. You got it spot on.

Well, this is because The document can paint only HTML and its string counterparts. The only way you can see the object is to do carObject.toString(). The object is something that the javascript language can interpret, so when you are outside of the javascript context, you need to respect the html syntax.

Hope this clears it out.

First Part:

  1. we don’t have a set number of variables or numbers used for a string to be accessed.
  2. an array
  3. they are expressions that access a value
  4. null and undefined
  5. with a dot or [] brackets value.x or value[x]
  6. methods are properties that contain functions
  7. Objects contain an arbitrary collection of properties.
  8. objects allow you to combine properties of an object which are values that can vary from one object to another
    additionally they contain methods as which can preformed at different times, in comparison to other objects methods.
  9. objects are made up of attributes and methods. Each attribute value can be unique to it’s respective object. Each method can be called to perform at a unique time for each respective object as well.
  10. it seems likely that it adds more flexibility and dynamisms to JS but it allows for more complex hacks to be performed.

SECOND PART:

  1. new properties aren’t remembered. they are mutable and can’t be changed.
  2. they allow the function to accept an infinite amount of numbers as an array.
    4.converting data into a flat description for storage or communication purposes.
  3. it is serialisation format and even operates outside of JavaS
  4. JSON doesn’t allow functions, bindings, to performed. it only allows for 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 need to track events that occur together to determine correlation and causation between them. Performing operations on data sets with more than one value.

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

Arrays and objects.

3. What are properties in Javascript?

Qualities of strings, values, and objects–such as length or type–which carry extra data that can be worked with programmatically. The Math object has many properties, such as max and min, and every string and array has a length property–just as a few examples.

4. Which values do not have properties?

Null and undefined.

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

First is by using dot notation, which requires knowing the name of the property you want to access. The second way is through square brackets, which will evaluate an expression inside the brackets to access the property.

6. What are methods?

Operations that can be done on objects and values that are similar to properties. Methods are properties that hold function values, such as toUpperCase and toLowerCase.

7. What are objects?

A collection of user defined properties, values, and arrays defined under one binding. Objects may include many different kinds of data and may have any number 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)?

The ability to organize and run computations on data that exists as a sequence of numbers and strings, such as establishing correlation or causation between events

9. How do you define an object? What can you say about the mutability of Javascript objects?

An object is a collection of properties and values. Mutability makes it possible to change these values, so a JavaScript object can have different values and properties at different times.

STRINGS AND THEIR PROPERTIES

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

Because they are not objects, and only objects can have their properties changed.

2. What are rest parameters?

Parameters that refer to an array of any size, which allow every value inside the array to be evaluated as parameters in a function without having to specify them in the function itself.

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

When we convert data into a flat description so it can be easily transmitted to other computers.

4. What is JSON?

A format for storing and sending data over networks.

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

All property names have to be surrounded by double quotes, and only simple data expressions are allowed. There are no function calls, bindings, or any kind of computation, and comments aren’t allowed.

1 Like
  1. The weresquirrel chapter illustrates the concept of using an array to store a list of activities together with a Bollean value which we can group together into an array of entries.
  2. Arrays store multiple values.
  3. Javascript properties are expressions that refer to a value or function.
  4. Null and undefined.
  5. We access properties by using either a dot or square bracket (i.e. value.x or value [x].
  6. Methods are properties that contain functions (i.e. push, pop, toUpperCase).
  7. An object is a collection of defined properties
  8. An object can combine value types.
  9. An object is an entity with defined characteristics and properties all grouped together.
  10. Objects can change to have different content at different times.

  1. A string is immutable.
  2. Rest parameters allow us to call functions and hold multiple arguments in an array.
  3. Serialisation is the converting of data into a readable format which can be stored or sent independently to another computer.
  4. JSON stands for JavaScript Object Notation, and it is a data storage and communication format compatible with languages outside of JavaScript.
  5. JSON converts coding to actual values, with no computation and no comments.
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?
    The need to store a list of activities and a Boolean value that indicates whether Jacques turned into a squirrel or not. Ideally, we would like to group these together into a single value and then put those grouped values into an array of log entries.

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

  3. What are properties in Javascript?
    Properties are characteristics of a value.

  4. Which values do not have properties?
    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?
    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 a set of daily log entries - each entry stores a list of activities and a Boolean value.

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

  10. What can you say about the mutability of Javascript objects?
    Objects can change their properties, 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?
    Because such values are immutable and cannot be changed.

  2. What are rest parameters?
    Functions that accept any number of arguments.

  3. What is serialisation and what is a use case of serialisation of data?
    Serialization is the conversion of data into a flat description. A use case is to save space in the computer’s memory.

  4. What is JSON?
    A popular serialization format.

  5. 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?

These chapter introduces the issues of keeping track of various form of animals, their characteristics and behaviours in a daily log, which variables types like strings or integers are just single data type at a time. The problems introduced the need for special organized collection of dataset and functions to order to track log each animal’s characteristics and behaviours into a unique group and their relationships.

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

An array and object is a data structure can be used to store a collection of related pieces of data. Each data value in an array can be accessed via the index of the array that is pre-defined in a sequential order.

  1. What are properties in Javascript?

Properties are the values associate the characteristics or attributes of an interest or things.

  1. Which values do not have properties?

Properties that have null or undefined value represent no properties

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

We can access the value using the dot notation follow by the property’s name or via a square brackets with an index or property name within the square bracket.

  1. What are methods?

Methods are functions in an object that are used to execute to perform predefined tasks on the properties of the object.

  1. What are objects?

Objects are abstract things of interests or representation of physical things in computer programming and an object contains a collection of properties and it’s related functions or other related objects.

  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 abstract of real-world entities and how they can communicate or collaboration with other objects to accomplish a desired task while value types are used to store atomic data values and uses a set of independent functions to manipulate on these atomic data.

  1. How do you define an object?

To define an object, define the object’s name, follow by curly brackets and then define it’s members for the object type by specifying the member’s properties, and methods within the curly brackets.

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

Values in the properties in an object can be modified or changed and can have different values at different times.

SECOND PART:

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

Because string variable is a primitive data, is immutable and not an object, therefore cannot have properties.

  1. What are rest parameters?

Rest parameters is a dynamic parameter that allows a function to capture an indefinite number of augments as an array pass to it. It can only be placed as the last parameter in the function’s parameter list.

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

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

Serialization is a technique of translating in-memory data structure or object state into sequence of bit stream for data communication which that can be stored or transfer. Used for storing into a file and deserialized for use later or transmitting across a computer network to another computer.

  1. What is JSON?

JSON is an open standard data interchange file format that is self-describing and language independent, a lightweight human readable text consisting of name-value pairs that can be stored and transmitted to another computer over the network. It’s a data interchange format known popularly as JavaScript Object Notation.

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

Unlike JavaScript objects, in JSON all property names must be enclosed within double quotes and allow simple primitive data expressions like array, Boolean, numbers, strings. Comments, function calls, bindings or of any computation involved are not allowed.

1 Like

strong textFIRST PARTstrong text

  1. This subchapter introduce the problem of organizing a series of daily events
    into a journal. Strings and integer type variable are not suitable for this task.

  2. Object is the variable type that can be used to
    solve the problem of storing multiple values.

  3. Properties are the characteristics of values in javascript.
    An example of property is the length of an array.

  4. Only null and undefined are values without properties.

  5. To access the properties in a value there are two ways:
    a) value.x
    b) value[x]

  6. Methods are properties that hold function values.

  7. Objects are sorts of bags to collect properties.

  8. Objects allow to store an arbitrary number of properties,
    giving to them arbitrary names.

  9. Object are arbitrary collections of properties.

  10. The property of strings, numbers and booleans can’t be changed (non-mutability).
    The property of objects can be changes (mutability).

strong textSECOND PARTstrong text

  1. It is not possible to add a new properties to a string variable because
    it not an object variable.

  2. Rest parameters are used when we want to define a function that gets in
    input an undefined number of arguments.
    the notation of a rest parameter is the following:
    …restParameterName

  3. OK

  4. Serialization is used for storing data and for sending data to another computer.
    The data are converted into a flat description.

  5. JSON (JavaScript Object Notation) is the most popular format for javascript serialization.

  6. JSON has come resctrictions in comparison with plain javascript:
    a) all property names have to be sorrounded by double quotes
    b) only simple data expression are allowed (no functions calls, bindings or anything
    the involves actual computation

1 Like