Data Structures (Arrays and Objects) - Reading Assignment


#143
  1. A valid way of storing multiple variables was needed.
  2. Arrays store multiple sets of data.
  3. Properties express the values and can be accessed with a . or [].
  4. nul and unidentified.
  5. . or [].
  6. The function value in the property.
  7. Objects are an arbitrary collection of properties, to create objects use brackets as an expression.
  8. Objects enable us to collect and hold different data types.
  9. contain list of values within the brackets [“1”,“2”].
  10. Strings and booleans are immutable but you can change the properties within objects, causing the value to alter.

PART 2.

  1. Strings are not objects and are immutable.
  2. The rest parameter is called with ‘…’ before the functions last parameter, the rest parameter is bound to all further arguments in the array.
  3. Converted data stored in memory into a flat description.
  4. JavaScript Object Notation is a format used for data storage.
  5. Property names need to be surrounded in double quotes.

#144

PART 1

1. The problem presented by the weresquirrel situation is finding a way to store the variety of data needed. A String stores only a series of characters… An integer stores numbers.

2. An array is used to solve the problem. It is possible with a string or an integer but the process would be laborious The better choice is to use an array as a variable type.

3. Properties in JavaScript is derived from the definition of property as being " an attribute, quality, or characteristic of something". Properties in JavaScript are accessed from a value using an expression such as: myString.length .

  1. While most values have properties null and undefined do not. Using either of these as a property will produce an error.

  2. Properties in JavaScript are mainly accessed two ways by using a dot or square brackets. The choice has to do with interpretation. The dot has to do with the literal or exact name of the property. The square brackets deals with what is in the expression between the brackets You might say that the dot is the property and the square bracket evaluates the property.

  3. Methods in JavaScript has to do with the procedure of the property relative to the indicated value. When the property contains a function or functions it becomes a method or how the value will proceed. The method is what the function does. One instructor wrote, "Methods are the functions that let the object do something or let something be done to it."

  4. In JavaScript almost everything is an object. Objects are a collection of properties. The values of the collection of properties are arbitrary. However, you may create your own. The objects can be modified.

  5. The problem solved by objects is the ability to store different sequences of values. This object is called an array .

  6. Objects are a collection of related data and/or functionality. They usually consist of several variables and functions.

  7. A mutable object is an object whose properties can be modified after it is created Examples of some JavaScript values that are mutable include objects, arrays and functions. Strings, numbers and Booleans are examples of values that are immutable or cannot be modified.

PART 2

  1. You cannot add new properties to a string. Strings are immutable and new properties cannot be added to them because they are not objects. But string values have other methods of built-in properties that can be used that resembles the array. However these properties are constant.

  2. The rest parameters allows us to access an indefinite number of arguments as an array. This is accomplished by placing three (3) dots inside the parenthesis () before the last parameter of the function. Any parameters listed before the three dots are not considered as part of the array. There is also the spread operator that uses the same basic action to add and copy elements into an existing array.

  3. (Reading Instructions)

  4. Serialization is taking a complicated and sometimes lengthy block of objects and arrays and converting it into a string. These are in your computer’s memory in such a way that makes it difficult, if not impossible, to send it to another computer sequentially over the network. In order to do that it must be translated into a stream of bits. The data can also be serialized and saved into a file for later use.

5.What is JSON? In order to accomplish the transmission of the data it must be converted into a flat description array… Javascript has provided a serialization format for this purpose called JSON. It is a storage and communication format designed for the Web. The function JSON.stringify and JSON.parse in the code will convert the data to and from that format.

  1. JSON and Javascript are similar in language but because JSON is sent over HTTP it is being transmitted as plain text and not as a programming construct. Consequently JSON has to be in a more consistent form. All property names have to be surrounded by double quotes. Only simple data expressions are allowed. No actual computations are allowed. Neither are comments

#145

Part One:

  1. If we want to store chunk of data for example collection of numbers like 2,3,4,5,and 10. If we use string for representing those no’s then the string like “2 3 4 5 6 10” but we are unable to get back the numbers from the string. So by using string or integer we are unable to store chunk of digital data.
  2. Arrays
  3. All JavaScript values having properties. ex. myString.length access the length property of value myString. Math.max aceess the max property in the Math object.
  4. null and undefined
  5. first: value.x here x is property name. second: value[x] here x is expression so after solving the expression we get the property name.
  6. Property that contain function called methods
    ex: let doh = “Doh”;
    console.log(doh.toUpperCase());
  7. Different types of values we can store in single objects.
  8. We can store number, string and Boolean values in single object.
  9. arbitrary collection of properties
  10. JavaScript object values are changeable so called as mutable.
    ex: let object1 = {value:10}
    object1.value =15;

Second Part:

  1. If we define the new property to the string it does not store so we can’t add the new property to the string
  2. for writing the function three dots are used before the functions last parameter.
    let numbers = [5, 1, 7]
    console.log(max(…numbers));
    // 7
  3. serialization means flat description of data. it is used for data storage and communication on the web.
  4. JSON is JavaScript Object Notation. It is a format for data storage and communication over the internet.
  5. All property names in JSON are surrounded by double quotes, only simple data expressions are allowed, comments are not allowed in JSON.

#146

PART 1

  1. Storing a sequence of values
  2. Array
  3. Properties are pre-defined values that are accessed thru expressions.
  4. Null and undefined are two values that could not have properties.
  5. We can access properties in JavaScript with a dot and with square brackets. When using a dot, the word after the dot is the literal name of the property. When using square brackets, the expression between the brackets is evaluated to get the property name.
  6. Methods are properties that contain functions.
  7. Objects are values that are arbitrary collections of properties.
  8. Properties of objects can be changed, thus, they are mutable. Integers, strings and boolean expressions are immutable.
  9. You define an object by following the binding with braces. Inside the braces is a list of properties you want to assign, separated by commas.
  10. Objects’ properties can be changed, causing a single object value to have different content at different times. Also, there is a difference between having two references to the same object and having two different objects that contain the same properties. In the former case, if you create a new object by equating it to an existing one, any change made to either one of them would change the other. If you define 2 objects separately, they are not equal even though you begin by assigning the same properties inside each.

PART 2

  1. A string variable is not an object, thus, it doesn’t store any other property other than what’s inherent of its type.
  2. Rest parameters allow evaluation for any number of arguments. It can also evaluate each content of an array or allow its contents to be spread out.
  3. I still read this, thanks for the concern.
  4. Serialization is conversion of data into a flat description. This is done to save data for later access, and also to share it over the network.
  5. JSON stands for JavaScript Object Notation, widely used as a data storage and communication format on the Web.
  6. In JSON, property names have to be surrounded by double quotes. JSON has restrictions, such as only simple data expressions are allowed - no function calls, bindings or computation. Comments are also not allowed.

#147

Hi @ivan and community,

+++++++++++++++++
+++ 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 problem in the chapter is about objects. The problem can’t be solved with only using native datatypes like char, String or int. The combination of them is the key to success. To be able to create objects that are existing for example of several Strings and int- or float-variables, is the goal of this chapter.

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

A array or a list can hold several objects that are type of different datatypes.

  1. What are properties in Javascript?

Properties are additional informations about values in the script / program. For example, “length” is a property of an array.

  1. Which values do not have properties?

“null” and “undefined”.

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

“value.” or “value[‘propertyName’]”

  1. What are methods?

Methods are code that can be executed on objects or directly in the body of a HTML document. Methods can read, manipulate and delete variables.

  1. What are objects?

Objects are a collections of several and different datatypes combined into a centralized structure.

  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 by far more complex as native datatypes and therefore, more complex tasks are able to do and more complex problems are able to solve due to objects. Furthermore, when creating objects the programmer can create own methods that can be executed on the objects, which leads to a powerful way to data management.

  1. How do you define an object?

var myObject = {name: “red”, size = 10}
Objects are defined as any other datatype.

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

Important is to differentiate between the references to a variables and the value the reference is pointing at. Two different references, which means two different objects, can hold the same value.

+++++++++++++++++
++ SECOND PART++
+++++++++++++++++

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

They have no properties because they are no objects. They are built-in native datatypes of JavaScript. They have built-in functions like “slice()” or “indexOf()”.

  1. What are rest parameters?

The rest parameters makes it possible to create functions with variable length of the input parameters.
function getMax(…numbers) { return 0 };
// getMax(1,2); getMax(3,5,8,6); getMax(2,3,4,5,6,7,9,9);

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

I don’t skip anything! =D

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

Serilization is the process of storing informations from objects of a running application in a normalized format like JSON.

  1. What is JSON?

JSON is a standard, a norm, a datatype which is used to send data in a performant manor through the network. This format is widely used to do communication between different computers.

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

Only simple text and format is allowed in JSON. No function, no bindings, no comments. The receiver need to information how to interpret the received JSON file.

Cheers
OtenMoten


#148
  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 to analyze sequences of values and how many times they appear in a given set of instances. I think that’s what it means?

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

Arrays. They can store multiple data types and call them individually, like a weapons array.

  1. What are properties in Javascript?

They are the units in which values are stored in an array. When using .x, where x is the name of the property, the array will pull the exact literal value of x, which if you do [x] or [“x”] in the case of a name or something, it’ll run it through, evaluate, and just pull the value.

  1. Which values do not have properties?

Null and undefined.

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

.x and [x]

  1. What are methods?

Properties that contain functions are called methods.

  1. What are objects?

Objects are arbitrary collections of properties that can later be analyzed using if else booleans and stuff? Like in the weresquirrel example. Object groups of possibilities as to why he turned into a weresquirrel.

  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’s able to store a list of values along with Boolean if else results for them.

  1. How do you define an object?

So, you start off with { then you list the overlying boolean value which true or false. Then announce the area and put : at the end, then list the array’s properties inside square brackets like so [“x”,“y”] and so forth. Then yo close the whole object with }; as usual. Then you run it and profit.

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

I’m not sure if I quite get it, but apparently objects are mutable in the sense that the properties within objects can be modified and cause them to refer to different things at different times? Not sure lol.


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

These values are immutable and cannot be changed, unlike properties in arrays.

  1. What are rest parameters?

I don’t quite get it. But I understand that it has something to do with gathering all the rest of the parameters and arguments into the array, like including them all, just like an etc kind of function the English language.

  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?

JSON, basically how stuff and arrays and shit are written out in JS.

  1. What is JSON?

The way we learn to write out arrays in JS but with some restrictions.
“squirrel”: false,
“events”: [“property1”, “property2”, “property3”]
};

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

You can’t put comments, all property names must be surrounded by double quotes, only simple data expressions allowed, no function cells, bindings, or anything that involves actual computation.


#149
  1. The sub-chapter weresquirrel introduce a problem where variables like strings can only hold one type of data.
  2. Array is a variable type that can be used to solve the problem of storing multiple values.
  3. Properties like length, values, and index in Javascript define certain characteristics
  4. Undefined and null variables don’t have properties.
  5. Properties can be accessed by either using square brackets [ ], or by using dots like array.length
  6. Methods are properties that hold function values. They are special kinds if functions that only work on the value they belong to.
  7. Objects are collections of properties, users can store different value types inside of them.
  8. Objects can store different types of values, such as booleans, strings, integers, and arrays.
  9. Objects are defined like other variables, but with the value contained inside braces.
  10. Javascript object values can be changes

Second Part

  1. String valuables are immutable
  2. Rest parameters are the use of any number of arguments
  3. Great
  4. JSON is short for JavaScript Object Notation. It’s a serialisation format that is widely used for data storage.
  5. JSON is different from the way programmers write objects in plain Javascript because, no bindings, function calls, or anything that requires computation. All property names need to be surrounded in double quotes and only simple data expression.

#150

First Part:

  1. A variable type is needed that can present a sequence of data.
  2. Arrays
  3. The properties of an object determine its characteristics.
  4. Null and Undefined
  5. You can access the property of an object using dot recording: .name .length .age …and with square brackets: value[x]
  6. Methods are properties that contain functions.
  7. Object are arbitrary collections of properties, are declared using curly braces {…}
  8. Object contain of different value types.
  9. var user = { name: “Julia”, age: “25”, friends: [“Alex”, “Adele”, “Peter”], new: false };
  10. Objects can change their properties, causing a single object value to have different content at different times.

Second Part:

  1. Because it is not object, it is immutable and cannot be changed. It have built-in properties.
  2. The rest parameter syntax allows us to represent an indefinite number of arguments as an array.
  3. Serialization is the process of converting an object in memory to another format that can be used to store it in a file or send it over a network.
  4. JSON is serialization format, understandable to almost any other language (Javascript, Java, C #, C ++ …)
  5. Comments, functions, bindings are not allowed in JSON. All property names have to be surrounded by double quotes.

#151
  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?
    Massive amount of data cannot be stored and evaluated as efficiently as objects structures with arrays.

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

  3. What are properties in Javascript?
    Properties are the values of an Array

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

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

  6. What are methods?
    Property functions are called methods

  7. What are objects?
    Objects are sequence of data. It can store boolean, integers, strings

  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)?
    It includes boolean variables that arrays cant.

  9. How do you define an object?
    Let objectname = { }

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

Think about the following questions:

  1. Why can’t you add new properties to a string variable?
    JS only supports some inbuilt properties. New properties doesnt stick.
  2. What are rest parameters?
    Three dots that allows us to free the function from input limits
  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 objects to a flat description.
  5. What is JSON?
    Javascript object notation. A widely used communication format on web.
  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    Comments are not allowed. Property names are surrounded by double quotes. Functions are not allowed. Only simple data descriptions will be given

#152
  1. It required to store many values in a single binding.
  2. Multiple values can be stored in a array.
  3. Properties are some features or functionalities that a value provides and can be accessed when required.
  4. null and undefined.
  5. we can access the properties by using a . or a [ ].
  6. The properties that have function as a value are called methods.
  7. Objects are arbitrary collections of properties.
  8. Objects can contain multiple properties in a single binding and each property can be accessed as per the requirements.
  9. Objects are defined in the same way as the other variables but the value is wrapped inside braces { }.
  10. The properties of an object can be changed in javascript but they are different from the properties of some other object.

Part 2

  1. Strings are immutable therefore we cannot add new properties to them.
  2. In rest parameter the number of arguments are not fixed. We can pass an array as an argument.
  3. Serialisation means to convert data into a flat fdescription.
  4. A popular serialization format is called JSON.
  5. 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.

#153

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 this occasion we need to collect multiple variables and organise them. A simple string or integer variable can not represent such information itself.

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

An array can be used to store a sequence of multiple variables.

3. What are properties in Javascript?

Most Javascript values have properties. These define some characteristic about the values in a data structure, such as the length of an array or the index of a value.

4. Which values do not have properties?

The exceptions are null and undefined. If you try to access a property on one of these nonvalues, you get an error.

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

The two main ways to access properties in JavaScript are with a dot and with square brackets. Both value.x and value[x] access a property on value

6. 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”.

For example:

console.log(doh.toUpperCase());

// → DOH

7. What are objects?

Objects are arbitrary collections of properties. One way to create an object is by using braces as an expression.

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

With Objects we can store sequences of multiple different value types.

9. How do you define an object?

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?

The values numbers, strings, and Booleans, are all immutable. Compared to this object values can be modified. Their properties can change their value.

Second Part:

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

A string varible doesn’t actually store properties, which you would like to add like for objects. The values numbers, strings, and Booleans, are all immutable.

2.What are rest parameters?

The rest parameters gather all the remaining values in an array.

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

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

4.What is JSON?

JSON is a popular serialization format. It is widely used as a data storage and communication format on the Web.

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

All property names have to be surrounded by double quotes, and only simple data expressions are allowed—no function calls, bindings, or anything that involves actual computation. Comments are also not allowed in JSON.


#154
  1. Variable types such as strings and integers are only able to hold a single type of data. What our friend needs is a data structure that is capable of storing multiple values and data types in order to keep all of the information organized.

  2. Java Script provides a data type specifically for storing sequences of values. It is called an array and is written as a list of values between square brackets, separated by commas.

EXP: let listOfNumbers = [2, 3, 5, 7, 11];

3.Properties (quality that something has), define some characteristic about the values in a data structure, such as the length of an array or the index of a value.

  1. null and undefined are exceptions with no properties.

  2. Access to properties has two main ways value.x and value[x].
    The difference is in how x is interpreted. When using a dot, the word after the dot is the literal name of the property. When using square brackets, the expression between the brackets is evaluated to get the property name.

  3. Properties that contain functions are generally called methods **(things they can do).

  4. Objects are arbitrary collections of properties and methods that called functions.

One way to create an object is by using braces as an expression.

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

Braces in java script mainly used to describe an object.

  1. Value type such as string, array and Boolean are not objects those are primitive type as such they can´t be expanded to properties and method like an object.

  2. Objects in JS are the same as objects in real life they can have qualities and things they can do.

10.The mutability of Javascript objects means that the values they contained can be changed.


  1. Those values are immutable and cannot be changed.

  2. When you pass an argument use spread operator (…n) that´s called rest parameter.

  3. Serialization means data structure converted into a flatten String.

It´s necessary that data would be translated into stream of Bits that we can send it over connection and then the recipient will serialize it and reconstruct an object.

  1. JSON stands for JavaScript Object Notation used as a data storage and communication format on the Web.

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