Data Structures (Arrays and Objects) - Reading Assignment

  1. All information can’t be stored in variables of only strings or integers.
  2. An array.
  3. Expressions that access a property of some value.
  4. null and undefined
  5. with a dot (e.g. value.x) and with square brackets (e.g. value[x])
  6. properties that contain functions are called methods
  7. Objects are arbitrary collections of properties
  8. The aggregation of different types of information into one variable.
  9. with braces {}
  10. Javascript objects contain properties that can be changed, ie they are mutable.

SECOND PART:

  1. Strings are immutable, it is impossible to change values of those types. This value will always stay the same.
  2. All further parameters in a function in addition to the required parameters. These are bound in an array.
  3. Conversion of data into a flat description, which saves the data from memory into a description that can be stored or sent.
  4. JSON is a popular serialization format, which stand for javascript object notation and looks similar to JavaScript’s way of writing arrays and objects.
  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.
1 Like

Part One

  1. Data structures that can store multiple values.
  2. Arrays and objects
  3. Properties are expressions that access a property of some value. For example Math.max, ,length.
  4. Null and undefined
  5. Value.x and value[x]
    6.Properties that contain functions are generally called methods of the value
    they belong to, as in “toUpperCase is a method of a string”
  6. Values of the type object are arbitrary collections of properties. One way to
    create an object is by using braces as an expression.
  7. Objects can store different data types.
    9.Inside the braces, there is a list of properties separated by commas. Each
    property has a name followed by a colon and a value.
    10.Values such as numbers, strings, and Booleans, are all immutable it is impossible to change values of those types. Objects work differently. You can change their properties, causing a single object value to have different content at different times.

Part Two

  1. Due to strings being immutable.
    2.It can be useful for a function to accept any number of arguments. For example, Math.max computes the maximum of all the arguments it is given. To write such a function, you put three dots before the function’s last parameter.
  2. Storing your data structure to a transfer compatible format.
  3. JSOn = Java Object Notation, this is the standard for serializing objects in JS.
  4. In JSON double quotes must be used and you cant define methods.
1 Like
  1. Objects and arrays need to be used because of the complex data that needs to be analyzed.
  2. array.
  3. Values that are bond to an object.
  4. null, undefined.
  5. [“propertyName”], .propertyName
  6. Methods are functions that are used with objects.
  7. An object is a collection of properties.
  8. Objects allow us to store and mutant more complex information structures.
  9. It is defined in code with{with key value pairs inside curly braces}
  10. Javascript objects are mutable.

Second Part:

  1. Because it is immutable
  2. Allows us to call a function with any number of parameters.
  3. Serialisation converts data to a JSON string. It is used to send and receive data.
  4. Javascript Object Notation
  5. JSON deletes the spaces in the code and makes the keys in objects strings""
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 here requires a mixture of data types to store information and keep it well organized. String and integer variables alone does not provide this kind of flexibility.
  2. What variable type can be used in order to solve the problem of storing multiple values?
    -We can store multiple data types within an object.
  3. What are properties in Javascript?
    -Almost all Javascript values have properties (the exception being null and undefined). Properties are identifying characteristics of a value and can be accessed either through “dot” notation as in “array.length” or bracket notation as in “array[length]”.
  4. Which values do not have properties?
  • Null and undefined do not have properties.
  1. How can we access properties in a value (two ways)?
  • Properties are identifying characteristics of a value and can be accessed either through “dot” notation as in “array.length” or bracket notation as in “array[length]”.
  1. What are methods?
  • Methods are functions associated with a value. For example, every string has a toUpperCase property which is a method of a string.
  1. What are objects?
  • Values of the type object 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 help solve problems where we need to keep track of mixed data types.
  1. How do you define an object?
  • You define objects using curly brackets. For example:
    let list = {
    value:1,
    rest: {
    value:2,
    rest: {
    value:3,
    rest: null
    }
    }
    };
  1. What can you say about the mutability of Javascript objects?
  • Javascript objects are mutable. That is, object values can be modified.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    -A string variable is immutable and therefore you can’t add new properties to it.
  2. What are rest parameters?
  • Rest parameters are parameters that allow passing any number of arguments to a function. For example, the Math.max function accepts any number of parameters to process in determining the maximum value.
  1. (Feel free to skip the sub-chapter of Math object and Destructing)
  2. What is serialisation and what is a use case of serialisation of data?
  • Serialization is the process of converting data into a flat structure. JavaScript uses JSON (JavaScript Object Notation) to convert data into a flat structure which in turn provides a convenient format to pass data between machines.
  1. What is JSON?
  • JavaScript Object Notation - a flat data structure used to serialize data.
  1. What are the differences between JSON and the way programmers write objects in plain Javascript?
  • It is similar but with a few restrictions: all property names have to be surrounded by double quotes, and only simple data expressions are allowed – no function calls, bindings, or anything that involves actual computation. Comments are not allowed in JSON.
2 Likes

Reading Assignment: Data Structures/ Arrays & Objects (Answers)

First Part.

  1. Condition that triggers transformation.
  2. Arrays
  3. Expression that access “property” of some value.
    4 null and undefined.
  4. value. and value[ ]
  5. properties that contain functions generally called methods.
  6. Objects are arbitrary collection of properties.
    8.Flexiability in programming.
  7. Collections of properties.
  8. Values contain can be changed…

Second part.

  1. Only values but not properties.

  2. Functions to except any number of arguments.

  3. console.log(Math.random());

  4. A) Convert data into flat description.
    B) Web communication format.

  5. A popular serialization format.

  6. Only simple data expressions, no function calls, bindings, or anything that involves computation.

:exploding_head:

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?

For purposes such as keeping a journal or storing key pairs in private/public key cryptography, it is useful to have data structures that can store multiple values as value-key pairs so that the relationship between variables becomes a part of the data itself. This is difficult / impossible to accomplish with using only strings / integers.

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

Objects

  1. What are properties in Javascript?

Properties are expression that contain certain information about a value. E.g. the length .length property contains the length of an array of a string.

  1. Which values do not have properties?

null, undefined

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

Properties can be accessed with either the dot or square bracket notation - string.length or string[length]. The difference between these notations is that the dot notation takes the expression after the dot as a string literal and tries to access a property with that name. The square bracket notation tries to evaluate the expression inside the square brackets, convert the result to a string and then access a property with that name. Dot notation only works with valid binding names, so no integers, spaces, etc.

  1. What are methods?

Properties that contain functions.

  1. What are objects?

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

Storing key-value pairs, triplets, etc. in single variable and being able to manipulate the contents of that variable freely by assigning new properties, removing old ones, etc.

  1. How do you define an object?

We wrap an object in curly braces and use : inside the object to tie together key-value pairs. We separate key value pairs by commas. For example:
let person = {
name : “John”,
age : 37,
profession : “plumber”
}
In this example, name, age and profession are properties of the object person. For example, person.name returns “John”.

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

They are mutable in the sense that their contents, i.e. properties can change, while their object value, i.e. identity stays the same. On the other hand, the contents of other variable types cannot be changed, e.g the code below logs “cat” because strings are immutable.

var test = “cat”;
test[0] = “r”
console.log(test);

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

Strings are not objects, so any paramaters you assign to them are not stored.

  1. What are rest parameters?

Rest parameters allow us call a function with an indefinite number of arguments, which are stored in an array represented by the rest parameter. This is useful if we don’t know how many parameters a function will have. A rest parameter is expressed by a three-dot notation before the last parameter. For example, let’s say we want a function that takes n numbers as input and multiplies these numbers, so we can write:

function multiplyN(…numbers){
var product = numbers[0];
numbers.shift();
for (number of numbers){
product *= number;
}
return product;
}

multiplyN(2, 2, 2); returns 8.

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

Serialization, as far as I understood from the book refers to extracting data from addresses in memory pointed to by variables and converting it to “flat descriptions” i.e. a particular format of said data for purposes of storage and communication.

  1. What is JSON?

It stands for Javascript Object Notation and it’s a popular serialization format.

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

JSON looks similar JS notation of arrays and objects, but all property names have to be surrounded by double quotes and no functions, bindings, comments or anything that requires computation is allowed.

A JSON entry might look like:
{
“name”:“Nara”
“present”:true
“hobbies”:[“fishing”, “hiking”]
}

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

‘String’ variables are not an object and thus they’re an immutable piece of code. Therefore, even though you can add properties to string values, they will not store them to be recalled later on.

  1. What are rest parameters?

Rest parameters are a prefix of three dots ‘…’ added to the front of a parameter. This allows this type of function to present an indefinite amount of arguments and convert them into an array.

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

Cheers! :grin: I read through it anyways… :white_check_mark:

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

Serialisation is the execution of code to gather and collect bytes of data and convert those data sets of that object into a filing arrangement that allows for…(a) transference across a network (b) storage into a filing system. For example, serialisation is commonly used for URL’s (Uniform Resource Locator). Bytes of information are serialised into file format to be transmitted across a network and then de-serialised or unpackaged to its original object format to execute the code for presenting a webpage layout. (code is flat packed into the serialised file)

  1. What is JSON?

JSON is an acronym for “JavaScript Object Notation.” This code language became popular for internet web based usage. JSON is used to take bytes of data or objects and construct them into a serialised format, a flat pack arrangement, in order to be easily distributed across a network. When this JSON serialised format file, or flat pack file arrives at its destination, it can stored or it can also be deconstructed and the original object code can be executed.

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

In the instance of JSON, there’s no deviation from simple form expressions. Further, no provision is available for comments within the code. Finally, there are no computational calling or invoking code such as functions or bindings. JSON also encloses the key and value expression within double " " quotation marks. ie… “key”:“value”

2 Likes
  1. Jacques needs a data structure to store more data, a variable will not be enough.
  2. An array can help us store multiple values.
  3. Properties in Javascript access the characteristics of values.
  4. Values with no properties are null and undefined.
  5. Two main ways to access properties in JS are with a dot or with square brackets.
  6. A method a set of instructions that are associated with an object.
  7. Objects are values of arbitrary collections of properties.
  8. Objects are special as they are able to hold as many different data types as we need.
  9. We put properties in curly braces seperatted by commas
    var person = {firstName:“John”, lastName:“Doe”, age:50, eyeColor:“blue”};
  10. Objects are mutable. Strings, numbers, booleans are immutable.

Part 2

  1. These values are immutable and cannot be changed.
  2. Rest parameter is bound to an array containing all further arguments. If there are other parameters before it, their values aren’t part of that array.
  3. Serialisation is the conversion of data into a flat description, which is useful for saving and sending data.
  4. JSON is a language-independent data format. It was derived from JavaScript, but many modern programming languages include code to generate and parse JSON-format data.
  5. JSON is used for simple data and cannot store functions and computation performing expressions. All the property names also surrounded by double quotes too.
1 Like
  1. Problems that cannot be solved with variable types such as strings or integers include data storage and retrieval. Storing all the necessary data as a string makes data manipulation awkward, and potentially difficult.

  2. To store multiple values, we can use the array data type.

  3. In Javascript, properties describe some characteristic of the variable in question. For example, string.length.

  4. The values null and undefined do not have properties. Attempting to access properties of these values gives the error: -> TypeError: null/undefined has no properties

  5. We can access the value of a property with dot notation e.g. string**.***length* accesses the property of string named length.
    The other way we can access the value of a property is with square brackets e.g. string**[**exponentiate(2,4)**]** evaluates the expression inside the square brackets, and uses the result
    as the name for the property of string. exponentiate(2,4) evaluates to 2^4 = 16, and so the 17th character of the string will be retrieved.

  6. Methods are properties (of values) that contain functions. For example, toUppercase is a method of the string hello world. It can be used as follows: var phrase = "hello world"; console.log(phrase.toUppercase());

  7. Objects are “arbitrary collections of properties”.

  8. Problems that cannot be solved with arrays or booleans include mutability - the ability to change the properties of values such as strings and integers. Normally strings and integers are immutable; their values cannot be changed.
    However, objects’ values can be changed.

  9. Objects can be defined using braces
    e.g. let menu = { offers: ["2 for Tuesdays", "Weekend Lunch", "Seasonal"], dishes: ["English breakfast", "Cheeseburger", "Spaghetti bolognese", "Jacket potato"] };

  10. The mutability of Javascript objects - to be able to change their values - gives the developer greater flexibility over their code.


  1. You can’t add new properties to a string variable because strings are immutable.

  2. Rest parameters allow functions to accept any number of arguments
    e.g. function max(...numbers) would return the maximum number from a group whose size can be given as desired.

  3. Serialization is the process of converting memory addresses and the pointers associated with these addresses, to “flatdescriptions that can then be
    sent to other computers in the network, who otherwise would not have access to such pointers and memory addresses.

  4. JavaSscript Object Notation (JSON) is a widely used data storage and communication serialization format.

  5. JSON does not allow comments. All properties must be surrounded by double quotes. Only simple data expressions; no computation. So no function calls, bindings etc.

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 requires a data structor that can hold multiple values.
  2. What variable type can be used in order to solve the problem of storing multiple values?
    We can use an array
  3. What are properties in Javascript?
    Expressions that access a property of some value
  4. Which values do not have properties?
    null and undefined
  5. How can we access properties in a value (two ways)?
    By using "“value.property” or "value[“property”]"
  6. What are methods?
    Properties that contain functions are generally called methods of the value
    they belong to.
  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)?
    Objects can contain different data depending on the needs of the program
  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 work differently. You 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?
    Such values are
    immutable and cannot be changed.
  2. What are rest parameters?
    These are denoted by a function’s last parameter with 3 dots before its name and are useful for functions that accept any number of arguments. When the function is called, the rest parameter is bound to an array containing all further arguments.
  3. (Feel free to skip the sub-chapter of Math object and Destructing)
  4. What is serialisation and what is a use case of serialisation of data?
  5. What is JSON?
    JavaScript Object Notation
  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    All property names need to be surrounded in double quotes and only simple data expressions are allowed. So no function calls, bindings, or anything that involves actual computation. Also, comments are not allowed in JSON.
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?
    When it is needed a variable that can store multiple values and different type of information.

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

  3. What are properties in Javascript?
    Are the values that an object has

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

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

  • Using a dot after the name of the object and then the property: string.lenght
  • Using square brackets: string[‘lenght’]
  1. What are methods?
    Properties that are functions: string.toUpperCase

  2. What are objects?
    Are data structures with collections of properties.

  3. 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 gather different types of values on same object.

  4. How do you define an object?
    Are data structures with collections of properties.

  5. What can you say about the mutability of Javascript objects?
    Objects can have data types modified after it was created.

SECOND PART:

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

  2. What are rest parameters?
    Allow a function to receive any number of parameters

  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?
    To convert data into a flat description, in order to easily share in a network.

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

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

1 Like
  1. The problems here can’t be solved by just using strings and integers because the different occurrences of the same event need to be distinguished for use in the program.

  2. Arrays can be used to store multiple values.

  3. Properties are listed in the object and are used to describe something about the object. They assign values and can be changed.

  4. ‘null’ and ‘undefined’ do not have properties.

  5. To access the properties in a value, the value name is followed by either a ‘.’ and the property or square brackets ‘[ ]’ containing the property name.

  6. Methods are properties that hold a function value.

  7. Objects are a way of grouping together properties with their values and putting them together under one single value.

  8. Objects can store property value pairs unlike arrays, which can only store a list of single values with non properties.

  9. An object is defined by assigning the properties and values to a binding using braces, e.g. var person = { name: jack, age 20 }.

  10. JavaScript objects can be changed from the outside by accessing them with their name followed by the property or the method, unlike numbers, strings, and boolean which are immutable.

Second Part:

  1. You can’t add properties to a string variable because they are immutable, as well as numbers and boolean values.

  2. Rest parameters are parameters of a function where it takes all remaining arguments it is given. It is bound to an array containing all further arguments.

  3. Serialisation is converting the data into a flat description and it is used for better sending of the data.

  4. JSON is a form of serialisation, JavaScript Object Notation. It is used as a data storage and communication format on the web.

  5. In plain JavaScript, objects are written with the property name followed by a colon and the value, if it’s a string it is in quotes. In JSON, both the property name and the value regardless of type takes double quotes. It cannot contain function calls, bindings, or any comments.

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 introduced here is about storing a collection of different data types.

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

An array can be used to store multiple values of the flasks type. If several types need to be stored than an object is the data structure to be used.

  1. What are properties in Javascript?
    Properties are expressions that access the property of some values.

  2. Which values do not have properties?
    Null ans undefined.

  3. How can we access properties in a value (two ways)?
    Using . And []

  4. What are methods?
    **Methods are functions attached to types that can be used on those types’ values **

  5. What are objects?
    They are collections of properties

  6. 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 allow to store different value types.

  7. How do you define an object?
    using {}

  8. What can you say about the mutability of Javascript objects?
    As un object can be accessed by reference its value can be changed by another object.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    String as all types are immutable

  2. What are rest parameters?
    ** Rest parameters define an array which can change size depending on he number of arguments used.**

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

  4. What is serialisation and what is a use case of serialisation of data?
    It is data that is converted into a flat description.

  5. What is JSON?
    It is the JavaScript Object Notation which is a data structure widely used on the Web.

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

[quote=“ivan, post:1, topic:3116, full:true”]
Welcome to the discussion about the reading assignment about data structures.

Leave your answers to the questions below in this thread. If you have any questions or you want to discuss something connected to the assignment feel free to do it in this thread as well, but please everything to the topic.

  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?
  2. What variable type can be used in order to solve the problem of storing multiple values?
  3. What are properties in Javascript?
  4. Which values do not have properties?
  5. How can we access properties in a value (two ways)?
  6. What are methods?
  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?
  10. What can you say about the mutability of Javascript objects?

SECOND PART:

  1. Why can’t you add new properties to a string variable?
  2. What are rest parameters?
  3. (Feel free to skip the sub-chapter of Math object and Destructing)
  4. What is serialisation and what is a use case of serialisation of data?
  5. What is JSON?
  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    ** In JSON the property values need to be expressed in 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?

The chapter introduces array and object variable types that are capable of storing information in complex data structures rather than simple string or integer values.

  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 give access to values.

  1. Which values do not have properties?

Null and undefined

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

we can do value.x and value[x]

  1. What are methods?

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

  1. What are objects?

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

other value types such as integer, string, array, boolean etc are immutable meaning can not be changed. where as in objects values are not constant and can be changed anytime. also equal values are considered not equally in different objects.

  1. How do you define an object?

curly braces followed by property names and set of values like so:
let myObject = {
propName1: [“value1”, “value2”],
propName2: value3
}

  1. What can you say about the mutability of Javascript objects?
    Mutability of JS objects is their value’s ability to be changeable.

PART TWO

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

Values of type string, number, and Boolean are not objects therefore can’t accept new properties.

  1. What are rest parameters?

When function accepts many number of arguments which are then spread into array. it is defined with three dots before functions last parameter.

  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?

Data serialization is the process of converting data objects present in complex data structures into a byte stream for storage, transfer and distribution purposes on physical devices. Storing and exchanging data between such varying environments requires a platform-and-language-neutral data format that all systems understand.

  1. What is JSON?

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.

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

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

1 Like
  1. Strings and Integers cannot store multiple values.
  2. Arrays solve this problem.
  3. A property is the association between an object key and its value.
  4. Null and Undefined
  5. First using a dot or square brackets
  6. Methods are properties that contain functions.
  7. Objects are an arbitrary collection of properties.
  8. Objects can store multiple values.
  9. By using braces as an expression.
  10. This gives a developer flexability as strings, numbers and Booleans are immutable.
    Part Two:
  11. String variables are immutable
  12. Rest parameters allow developers to target in an array skipping all other parameters.
    3.Skipped
  13. JavaScript Object Notation - data format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types.
  14. JSON looks similar to JavaScript’s way of writing arrays and objects, with a few restrictions. All property names have to be surrounded by double quotes, and only simple data expressions are allowed—no function calls, bindings, or anything that involves actual computation. Comments are not allowed in JSON.
1 Like

Part 1:

  1. The storing of multiple values in a single variable is the problem solved in this chapter.

  2. The variable type of arrays solve the problem of stoning multiple valies.

  3. Properties are expressions which access a property of some value.

  4. null and undefined do not have properties.

  5. Properties can be accessed either using dot notation ie. value.x or using square brackets value[x].

  6. Methods are property containing a function that is called against a variable (or array) which either performs an operation or retrieves a value.

  7. Object are collections of properties . Strings, integers and array are a specif types of objects.

  8. Objects allow the group of values including other object to build more complex structures

  9. Objects are defined using curly brackets and named pairs separated by a color eg. person = { firstName: “Fred”, surName: “Blogs”};

  10. Variable such as integers, string and arrays are immutable whereas object are not and can be modifed.

Part 2:

  1. New properties cannot be added to a string as string are immutable.

  2. Rest parameters allow for an array to be passed to a function allowing a variable and none-predefined number of arguments to passed to the function.

3 N/A

  1. Serialization is the process of converting data in memory to a flat format to allow for its storage or transmission to another system.

  2. JSON stands for JavaScript Object Notation is a popular serialization format used for transferring data.

  3. JSON needs for there to be double quotes around all property names.

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: It requires a variable that stores multiple values
  2. What variable type can be used in order to solve the problem of storing multiple values?
    A: Arrays
  3. What are properties in Javascript?
    A: values defined inside an object
  4. Which values do not have properties?
    A: null and undefined values
  5. How can we access properties in a value (two ways)?
    A: using a dot and the name of the property; a string inside square brackets
  6. What are methods?
    A: a property that contains a function
  7. What are objects?
    A: values that are a collection of properties
  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    A: they hold different values in the same variable in a convenient way
  9. How do you define an object?
    A: giving it a name and providing specifics within the curly brackets
  10. What can you say about the mutability of Javascript objects?
    A: it allows one to change the value within an object

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    A: it’s an immutable data; it cannot be changed
  2. What are rest parameters?
    A: Ability to represent specific parameters and any number of arguments to an array
  3. What is serialisation and what is a use case of serialisation of data?
    A: a conversion of data into flat descriptions; it helps with storing and sending data
  4. What is JSON?
    JavaScript Object Notation–used for data storage and communication
  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    A: JSON–property names have to be inside double quotation marks, with only simple expressions being allowed (no–functions, bindings comments, or computations)
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? Requires a variable that can store 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?
    values of the object

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

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

  6. What are methods?
    function of the value

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

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

  10. What can you say about the mutability of Javascript objects?
    Two different objects that contain the same properties are viewed as different.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Strings are immutable
  2. What are rest parameters?
    defined using"…"that can return 0 or more 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?
    Converting memory addresses to a description that can be stored.
  5. What is JSON?
    A serialization format.
  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. 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?
    Complex data organization.

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

  3. What are properties in Javascript?
    Properties are variables in an object.

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

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

  6. What are methods?
    A method is a function in an object.

  7. What are objects?
    An object is a data structure containing values or properties and functions or methods.

  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
    Objects allow organization of data and code under a single namespace.

  9. How do you define an object?
    There are a few different ways to define and assign the properties and methods of an object, such as;

var animal = { 
    type:"dog", 
    hairColor:"brown", 
    says:"bark"
    describe: function () {
        console.log("The " + this.type + " has " + this.hairColor + " hair " + 
        " and says " + this.says + ".");
    }
 };

// or

var animal = new Object();
animal.type = "dog";
animal.hairColor = "brown";
animal.says = "bark";
animal.describe = function () {
    console.log("The " + this.type + " has " + this.hairColor + " hair " +
    " and says " + this.says + ".");
}
  1. What can you say about the mutability of Javascript objects?
    Javascript primative variable are considered immutable, and objects are considered mutable. At first this may seem like an arbitrary distinction because values in both primitive variables and objects can be changed.
    This distinction is that Javascript primitive variables ARE objects, statically defined, or immutable, with properties and methods of their own. The properties and methods of primitive variables cannot be changed, while methods and properties of those defined as objects can.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    Because in Javascript, primitive variables are immutable objects.

  2. What are rest parameters?
    Rest parameters allow any number of arguments to be passed, and accepted, by a function.
    This is another way to pass an array of arguments.

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

  4. What is serialisation and what is a use case of serialisation of data?
    Serialization is the process of organizing object data by a standard spec to be stored or transferred.

  5. What is JSON?
    JSON is an acronym for JavaScript Object Notation, it’s Javascripts serialization specification.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON appears very similar to objects written in Javascript. Javascript is flexible, allowing many differing formatting and definition choices to the programmer. JSON is a much more strict and simplified standard, for saving the properties only, which reduces data size and incompatibility issues.

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?
    // He will need a database to store his logs from day to day.

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

  3. What are properties in Javascript?
    // It is a characteristic attached to value that can be called upon using . or [x]

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

  5. How can we access properties in a value (two ways)?
    // using . (e.g. item.length) or using [x] (for property name)

  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)?
    // I can add characteristics to an object, not to a string.

  9. How do you define an object?
    // Arbitrary collections of properties.

  10. What can you say about the mutability of Javascript objects?
    // Object values can be modified. Types of objects such as strings, numbers or booleans are immutable.

SECOND PART:

  1. Why can’t you add new properties to a string variable?
    // Values of type string, number or boolean are not objects and JavaScript will not store properties to them.

  2. What are rest parameters?
    // It is a parameter that can be used in place of a number of other parameters, a substitute for a long array of parameters when being called to a function.

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

  4. What is serialisation and what is a use case of serialisation of data?
    // To convert data into a flat description.

  5. What is JSON?
    // a popular serialisation format, short 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 quotation marks and only simple data expressions are allowed.

1 Like