Data Structures (Arrays and Objects) - Reading Assignment

Data Structures (Arrays and Objects) Assignment

  1. A string or integer holds only a single value. A data structure is needed to hold and access multiple values in the form of arrays
  2. An array is a variable type that can hold multiple values
  3. Properties are the characteristic of valies. They are values that are usually strings for objects and numbers when e.g. some are built into JS like .length
  4. Null and undefined do not have properties
  5. Properties can be accessed with a dot. The word after the dot is the litral name of the property. you can also use brackets [ ]. The expression between the bracket is evaluated to get the property name - uses the result converted to a string
  6. Methods are propeties that hold function values Example: .length, .toUpperCase, .toLowerCase, .push, .pop
  7. An object is a value that is an arbitrary collection of properties. They are stored in curly braces and have sets of properties paired with a value. The key and value can be a binding name, string or number
  8. Objects are able to store various data types paired with keys and thus can provide correlation. These object pairings ar mutable unlike immutable value types like integer, string.boolean, and arrays.
  9. Objects are created by using curly braces. Properties are listed by name followed by a colon and value, then separated by commas.
  10. Objects are mutable as the values can be Created, Read, Updated, or Deleted

Second Part

  1. String variables are primitive types that hold values which are immutable
  2. Rest parameters bind to an arrray and allow arguments to be spread and applied using functions. A rest parameter is designated by three dots before the functions last parameter
  3. Serialization is what JSON uses to access arrays within arrays by by converting data into a flat description that is useable by other computers and programs.
  4. JSON stands for Javascript Object Notation used for data storage and communicaiton by seriallization of data key pairs.
  5. JSON provides simple data expressions using double quotes for property names and does not allow functins, bindings, comments, or any programmable computations
1 Like

1.) The problem of needing data structure to keep track of and organize multiple data types and values is the problem that is introduced in the Weresquirrle story.

2.) A variable type that can be used to solve the problem of storing multiple values is called an Array.

3.) Javascript properties are expressions that use a property of a value within the code.

4.) Null and Undefined are the 2 exceptions and do not have properties.

5.) The 2 ways to access properties are to enclose the values in square brackets or to use a dot, ie. value.color

6.) Methods are properties that hold function value’s but work only on the values they belong to.

7.) Objects are collections of properties.

8.) Objects solve the problem of having various different data types, strings, etc. as needed for a program.

9.) objects can be defined as a variable with a list contained in braces as a value.

10.) Mutability makes it possible for one to change the object’s values.

2nd Partstrong text

1.) You can’t add new properties to a string because string variables are immutable and can’t be changed.

2.) Rest parameters are used to accept a multiple of number of arguments and is denoted by adding 3 dots, “…” before the last parameter.

3.) Serialisation is converting data into a flat description and is use to save the data to a file or to send the data to another party.

4.) JSON, (JavaScript Object Notation) is the format that converts the data into the flat description for sending or saving the data.

5.) JSON is restricted to using double quotes to surround all property names and that only simple data expressions are allowed; you can not use function calls, bindings or anything that contains computation; comments are not allowed in JSON format.

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?

Because the entires must contain various properties under the same objects at different times. This requires for the use of Objects which can store a list of properties under Objects which hold different values and the various values can be easily compared with one another and determine weather Jaques turned into a squirrel or not.

  1. What variable type can be used in order to solve the problem of storing multiple values?
    Arrays, strings and integers.

  2. What are properties in Javascript?
    Properties are certain aspects of an object which help define and or describe an object.

  3. Which values do not have properties?
    Null and Undefined.

  4. How can we access properties in a value (two ways)?
    They can be accessed by a period after the object or by brackets. Like so… person.lastName; or person[“lastName”];

  5. What are methods?
    Methods allow for a certain action to be taken within an object. They are “functions stored as property”.

  6. What are objects?
    Objects are a collection of properties and values inside the object.

  7. 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 have their information changed, shared, switched so that, addd flexibility to programming. Primitive values do not. Their information cannot be changed. They are immutable while objects are mutable.

  8. How do you define an object? An object is defined by using braces.

  9. What can you say about the mutability of Javascript objects?
    Object’ mutability in JS, means objects can have different bindings while possesing the same identity; while still “living seperate lives”. They are flexible, interchangeable…unlike primitive values which their values, cannot be changed.

------------------------Second Part----------------------------------------------------

  1. Why can’t you add new properties to a string variable?
    Because they are primitives and their valfues are fixed.

  2. What are rest parameters?
    Rest Parameters can process various parameters at once, by adding three dots to variables, like so: (…).

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

  4. What is serialisation and what is a use case of serialisation of data?
    The purpose of serialization is to format data into storage; converting it into a “flat description”, over the Web so that it saves memory. This format is called JSON, meaning JavaScript Object Notation.

  5. What is JSON? Respectively, it is a format for saving data over the Web, into a smaller filesize and wide compatability.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    A few differences are double quotes on property names. Only simple data expressions is allowed. No function calls, bindings or actual computation.

1 Like
  1. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    It introduces objects which are data sets, chunks of digital data, which can be mathematically processed and manipulated. It solves problems that involve relational data.

  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?
    They are characteristics of an object, often describing attributes associated with a data structure.

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

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

  6. What are methods?
    Properties that contain functions, such as toUpperCase, length, slice, etc.

  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)?
    Problems that involve relational data with different types of values.

  9. How do you define an object?
    An object is a “basket” of relational data, a storage space system that makes it easier to program solutions.

  10. What can you say about the mutability of Javascript objects?
    Objects are mutable; 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?
    Because strings are immutable.

  2. What are rest parameters?
    The use of … to call all values in an array.

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

  4. What is serialisation and what is a use case of serialisation of data?
    A more efficient way of storing data in a computer.

  5. What is JSON?
    A popular serialization format (stands for JavaScript Object Notation).

  6. What are the differences between JSON and the way programmers write objects in plain
    Javascript?
    JSON has restrictions, no comments, no function calls, bindings, or anything that involves actual computation is allowed.

1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers? Basically multiple problems (values) in diferent situation than can be grouped by logical relacion.

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

  3. What are properties in Javascript? Properties are additional bindings associated with a value like: lenght and Max

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

  5. How can we access properties in a value (two ways)? names a property directly
    "Some string".length; or by square bracket notation that evaluates an expression to look for a property "Some other string"["length"];

  6. What are methods? its a property holds a function as its value

  7. What are objects?it´s a collection of 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)?Objects particularly useful when dealing with large, complex sets of datas. and keep an undestandable structute.

  9. How do you define an object? when you declare a name = and then { open curly brackets with methods inside}

  10. What can you say about the mutability of Javascript objects? JS objects are mutabe , their properties could have different content at different times while the programs runs

SECOND PART:

  1. Why can’t you add new properties to a string variable? becaus string are “immutables”

  2. What are rest parameters? rest parameter use 3 … and a name “…restParameter”.It can be useful for a function to accept any number of 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?
    serialize the data. That means it is converted into a
    flat description.

  5. What is JSON? A popular serialization format, it used as data storageand communication format onthe web

  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?

For keeping a journal and collecting data in an organized manner for each day would be a difficult task with strings and integers alone.

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

Arrays can be used to store a collection of values in a single value.

3. What are properties in Javascript?

Most values have properties that can be called and perform different tasks on the stored values.

4. Which values do not have properties?

Null and undefined.

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

Dot notation: Math.max();
or
Call by name: Math"max";

6. What are methods?

Methods are properties of a value that can perform different useful functions. For example in case of an array, if we want to remove the last element of the array: array.pop();

7. What are objects?

Objects are value pairs stored in a single value.

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

Objects can store any type of value pairs and these can be later accessed. Objects can store arrays with booleans etc…

9. How do you define an object?

let ivanOnTech {
  days: [ "monday" , "tuesday" , "wednesday" , "thursday" , "friday" , "saturday" , "sunday" ];
  time: [ "8 am central european time" , "11:30AM, atomic weekend time"];
  person: Ivan;
}

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

Properties of objects are mutable. An object can have different values for a property at different times.

SECOND PART:

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

Immutability of the string variable prevents it, but also why would you want to do that? Objects are a more flexible datatype where properties can be added.

2. What are rest parameters?

With the three dot notation it is possible to call all the values of an array like:

let days = ["monday" , "tuesday"]
console.log(...days + " wednesday, thursday, friday, sunday, saturday")
//m o n d a y , t u e s d a y   w e d n e s d a y ,   t h u r s d a y ,   f r i d a y ,   s u n d a y ,   s a t u r d a y

Or to make a function or method accept all arguments it is given without setting up a variable.

function addEm (...numbah) {
 let result = 0;
 for (let number of numbah) {
    result += number;
  }
return result;
}
console.log(addEm(2,2,2,2,2,2,2))
//14

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?

As far as I understood, serialized data is basically a standard for data structures. It looks like an object, but it is not really connected to Javascript, other programs can also read the value pairs.

5. What is JSON?

The abbreviation stands for Javascript Object Notation.

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

JSON objects hold purely the data, functions or computations are not valid. Every property has to be in double quotes.

1 Like

FIRST PART
1. Instead of storing a single data, our friend from the story needs to store various data as to understand his condition. For this purpose, the best would be to build a data structure that stores all this information.
2. For storing multiple value we can use Arrays.
3. With certain expressions we can access the property of some value.
4. Only the values ‘null’ and ‘undefined’ will return an error.
5. We can either access properties through the dot annotation or through square brackets, but the result won’t be necessarily the same.
6. Methods are properties that contain functions.
7. Objects are arbitrary collections of properties.
8. Objects can store as many different datatypes as we need.
9. Objects are like boxes, identified by curly braces, that can have inside various properties and values that are innate to that object (although these can be modified, new can be added and even deleted).
10. Mutability in objects let us modify their properties and like that we can have a single object having diferent content at different times.
SECOND PART
1. We learned that strings are immutable: there is no way that we can change a string of ‘airplane’ to store some different property. The text inside the string value won’t be changed by any code.
2. They allow a function to accept any number of arguments.
3. Serialization is converting data stored in mamery into a flat description. It is used to save or share data over a network.
4. JavaScript Object Notation - the most popular serialization format used as a data storage and comunication format on the Web.
5. There are some 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, and no 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?
    Ans: Variable types such as strings and integers are not very effective at storing sequences of values. What is needed for Jacques is a data structure that is capable
    of storing multiple values and datatypes in order to keep all of the information organized.

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

  3. What are properties in Javascript?
    Ans: Properties define some characteristic about the values in a data structure, such as the length of an array or the maximum function in a Math object.

  4. Which values do not have properties?
    Ans: Null and undefined which are in effect “nonvalues.”

  5. How can we access properties in a value (two ways)?
    Ans: The two main ways to access properties in JavaScript are with a dot and with
    square brackets. Both value.x and value[x] access a property on value—but
    not necessarily the same property. The difference is in how x is interpreted.
    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. Whereas value.x fetches the property of value named
    “x”, value[x] tries to evaluate the expression x and uses the result, converted
    to a string, as the property name.

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

  7. What are objects?
    Ans: Values of the type object 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)?
    Ans: Objects are able to hold as many different datatypes as we need and organize them efficiently. We can use an array of objects to solve the “WereSquirrel” problem.

  9. How do you define an object?
    Ans: Braces are used to create objects. Properties inside the braces are separated by commas. Each property is named, followed by a colon and a value.

  10. What can you say about the mutability of Javascript objects?
    Ans: Values such as numbers, strings, and booleans are all immutable whereas object values can be modified. 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?
    Ans: Values of type string are not objects, they are immutable and cannot be changed.

  2. What are rest parameters?
    Ans: Rest parameters are bound to an array which contains all further arguments. This allows a function to allow any number of arguments. To add a rest parameter, you use three dots before the function’s last parameter.

  3. What is serialisation and what is a use case of serialisation of data?
    Ans: Serialization of data entails converting the data into a flat description. Since objects and
    arrays are stored in the computer’s memory as sequences of bits holding the addresses—the place in memory—of their contents, you have to somehow convert these tangles of memory addresses to a description that can be stored or sent and that is where serialization of data is helpful.

  4. What is JSON?
    Ans: A popular serialization format is called JSON (pronounced
    “Jason”), which stands for JavaScript Object Notation. It is widely used as a data storage and communication format on the Web, even in languages other than JavaScript

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    Ans: 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?

Objects are data structures that allow us build ore complex data structures. Strings, Booleans, and numbers are the atoms that data structures are built n.

  1. What variable type can be used in order to solve the problem of storing multiple values?
    Arrays and objects are the data structures used to store multiple values in aa variable.

  2. What are properties in Javascript?
    Properties are characteristics of values in Javascript. Or values associated with a Javascript object.

  3. Which values do not have properties?
    Null and undefined are values that DO NOT have properties associated with them.

  4. How can we access properties in a value (two ways)?
    The two ways to access properties are ‘dot notation’ ( array.value) and ‘brackets’ ( array[i]; )

  5. What are methods?
    Methods are properties that hold functions as values.

  6. What are objects?
    Objects are data structures that hold ‘lists’ or properties with corresponding values. Or Objects allow to arbitrarily collect values together.

  7. 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)?
    Allow for immutability, or change values w/o having to add to subtract variables.

Objects allow you to collect and group data together.

  1. How do you define an object?
    1- Create a binding and name it. 2- Use curly braces at the beginning and end. 3- List properties inside the braces, separate them by commas. 4- Each property has a name, separated by a colon: and a value.

  2. What can you say about the mutability of Javascript objects?
    Unlike strings, boolean, and numbers objects values are immutable and can be changed w/o having to add or subtract the value of bindings to achieve a new value which will be stored in a new binding or variable itself.

Section 2-----

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

  2. What are rest parameters?
    Allow me to represent an indefinite amount of arguments as an array.

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

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

  5. What is JSON?
    Javascript Object Notation is used to send send arrays & objects across a network by first converting them into a string vis JSON.stringfy and the JASON.parse to convert back to an object.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON’s names must be surrounded by double quotes, only simple data expressions are allowed, np functions, calls, bindings, or anything that computes. Comments are also not allowed.

1 Like
  1. This subchapter introduces objects and arrays that group values of different qualities together that strings/integers alone cant do.

  2. strings are a variable that allows us to store multiple values of the same data set.

  3. properties allow coders to access values within bindings.

  4. null and undefined.

  5. with a dot or bracket.

  6. Methods are properties that hold function values

  7. objects allow us to store arbitrary properties with a square bracket.

  8. They allow us to store integers, strings and boolean values at the same time that cant be done with specific variables alone.

  9. objects grasp values that can be held by other objects.

  10. Objects are not immutable, in that you can have an object storing to different values at different times.

  11. string values are immutable unlike objects, once a a string variable is created, its impossible to change.

  12. they denote (…) after the last parameter and are bound to every argument after.

  13. Serialization allows us to encode stored javascript data and compress it into a string for export.

  14. JSON is the serialization program of javascript.

  15. JSON is the simplified version of the code and does not allow computation expressions and exterior comments.

1 Like

PART ONE
1.- The problem that weresquirrel introduces that cannot be solved using bindings such as strings and integers is keeping log of multiple data or entries.
2.- Multiple values can be stored in an array.
3.- Properties are information or data available for a data structure or value in JavaScript.
4.- Null and undefined are the only values in JavaScript that do not have properties.
5.- Properties can be accessed as follow: value.Property; and can also be accessed with brackets as follow: value[“Property”].
6.- A method is a property that contains a function. Methods can take arguments.
7.- An object is a data structure that collects arbitrary properties.
8.- Objects can store multiple properties and are also mutable.
9.- An object for me is a collection of properties. For example a pet object can be: { animal: cat, color: brown, age: 9, aggresive: false}
10. Objects in JavaScript are mutable data.

SECOND PART:
1.- You cannot add a property to values like string, number or boolean because they are not objects in JavaScript; they are immutable.
2.- Rest parameters allows you to pass any number of arguments as an array.
4.- Serialization of data is the process of converting your data in a format that is flat.
5.- JSON is JavaScript Object Notation and it is a serialize form of an object to transfer or communicate.
6.- JSON contains double quotes for all parameters except simple numbers and booleans.

Hi Friends && Coders

I am trying to Create the following Array from an Empty array

journal1 =
{
Monday: {events : [“work”, “touched tree”, “pizza”, “running”,“television”"], squirrel : false},
Tuesday : {events : [“work”, “ice cream”, “cauliflower”, “lasagna”,“touched tree”, “brushed teeth”], squirrel : false},
Wednesday : {events : [“weekend”, “cycling”, “break”, “peanuts”,“beer”], squirrel : true}
}
];

Now to create the above array i wrote the following Code:

**Can someone please advise me where i am going wrong, i have been trying to solve the problem since hours, but unfortunately no success yet, i shall be extremely grateful **

1 Like

Hi Friends && Coders

I am trying to Create the following Array from an Empty array

journal1 =
{
Monday: {events : [“work”, “touched tree”, “pizza”, “running”,“television”"], squirrel : false},
Tuesday : {events : [“work”, “ice cream”, “cauliflower”, “lasagna”,“touched tree”, “brushed teeth”], squirrel : false},
Wednesday : {events : [“weekend”, “cycling”, “break”, “peanuts”,“beer”], squirrel : true}
}
];

Now to create the above array i wrote the following Code:
Hi Friends && Coders

I am trying to Create the following Array from an Empty array

journal1 =
{
Monday: {events : [“work”, “touched tree”, “pizza”, “running”,“television”"], squirrel : false},
Tuesday : {events : [“work”, “ice cream”, “cauliflower”, “lasagna”,“touched tree”, “brushed teeth”], squirrel : false},
Wednesday : {events : [“weekend”, “cycling”, “break”, “peanuts”,“beer”], squirrel : true}
}
];

Now to create the above array i wrote the following Code:

**Can someone please advise me where i am going wrong, i have been trying to solve the problem since hours, but unfortunately no success yet, i shall be extremely grateful **

1 Like
  1. Variable types such as Integers and Strings cannot hold Multiple Data types/ values.
  2. Objects and Arrays.
  3. 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. Null and Undefined.
  5. Example of two ways ==> Array.length or array[length]
  6. Methods are properties that hold function values.
  7. Objects are data structures with Multiple values that are capable of holding an arbritary collection of properties.
  8. Objects are special because they are able to hold many and many kinds of data types.
  9. Objects are always within braces {};
  10. Objects are mutable in Nature.

Second part :slight_smile:

  1. String is primitive in nature and can only hold a single immutable value.
  2. These are denoted by a function’s last parameter with 3 dots before its name and are useful for functions that accept any number of arguments. When the function is called, the rest parameter is bound to an array containing all further arguments
  3. Serialisation is converting data stored in memory into a flat description of what 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. JavaScript Object Notation is a serialisation format widely used for data storage and communication.
  5. Both value names and Properties 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

Homework on Data Structures(Arrays and Objects) - Questions November 22, 2020

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?
    Variables retain one type of data. Data structures allow the storage of multiple data types.

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

  3. What are properties in Javascript?
    Properties are the length and data type of a Javascript value.

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

  5. How can we access properties in a value (two ways)?
    By using a dot or square brackets in a expression.

  6. What are methods?
    Properties that contain functions are methods.

  7. What are objects?
    Objects cotain a collection of properties. They’re created using braces holding a list of data structure values with a comma.

  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 hold a variety of different types of data.

  9. How do you define an object?
    Objects are similar to variables that hold different values.

  10. What can you say about the mutability of Javascript objects?
    Values in a object can be changed.

Second part-

  1. Why can’t you add new properties to a string variable?
    Strings are immutable, because they hold specific data that defince the function of the code.

  2. What are rest parameters?
    Rest parameters allow a function to use any type of value as an argument.

  3. What is serialisation and what is a use case of serialisation of data?
    Seriallisation is a means of converting data into a flat description.

  4. What is JSON?
    JSON is a format to serialize data, use as data storage and a variety of communication formats.

  5. What are the differences between JSON and the way programmers write objects in plain Javascript?
    All property names must be surrounded by double quotes and only simple date expressions are allowed
    Functions, bindings, and comments are used in JSON.

-Hector A. Martinez

1 Like

Think about the following questions:

  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?

     Variable types as strings and integers can only hold a single type of data, which makes them all immutable.
    
  2. What variable type can be used to solve the problem of storing multiple values?

      	[ARRAYS] is a good example.
    
  3. What are properties in Javascript?

         Properties are a way for us to get a certain meta-information about an object; variables and arrays are types that we can do to them.
    
  4. Which values do not have properties?

       	The exceptions are null and undefined. When trying to access property on one of these nonvalues, then you will 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[]
    
  6. What are methods?

      Methods are functions that belong to the object that allows us for 	to do something to the data inside an object, such as a variables or arrays.
    
  7. What are objects?

     You can see objects as a type of blueprint where we put together similar properties and methods inside an object in order to group together and organize our code in a much better way than using variables and fucntions.
    
  8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?

        An object can hold different datatypes.
    
  9. How do you define an object?

                // This is the long way of creating a object, but there is a more 	simpler way.
    
                  let person = new Object();
    
                  person.name = "David"
                  person.eyeColor = "Brown"
                  person.age = 35;
                  person.updateAge = function() {
                    return ++person.age;
                  }
    
    
                  console.log(person.age);
                  person.updateAge();
                  conosle.log(person.age);
    
    
                  // a simpler way
    
                  let person = {
                name: "David",
                eyeColor: "Brown",
                age: 35,
                updateAge: function(){
                  return ++person.age;
                }
              }
    
              console.log(person);
    
  10. What can you say about the mutability of Javascript objects?

    In JavaScript, only objects and arrays are mutable, not primitive values. …
    A mutable object is an object whose state can be modified after it is created. Immutables are the objects whose state cannot be changed once the object is created.
    Strings and Numbers are Immutable

SECOND PART

  1. Why can’t you add new properties to a string variable?
    Becouse they are not Objects and such values are immutable and cannot be changed.

  2. What are rest parameters?

          Rest parameter is an improved way to handle function parameter, allowing us to more easily handle various input as parameters in a function.
          The rest parameter syntax allows us to represent an indefinite number of arguments as an array.
    
  3. What is serialisation and what is a use case of serialisation of data?

       Serialization 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. Its main purpose is to save the state of an object in order to be able to recreate it when needed.
    
  4. What is JSON?

       JSON is a standard text-based format for representing structured data based on JavaScript object syntax
       It is commonly used for transmits data in web applications sending some data from the server to the client so that it can be displayed on a web page.
    
    • Skip
  5. What are the differences between JSON and the way programmers write objects in plain Javascript?

       Diffrence between the JSON and JAVASCRIPT is that there are six data types that JSON supports are the following:
    
    
       Array
       Boolean
       Null
       Number
       Object
       String
       But, JavaScript Object support any data type that JavaScript (language) itself supports as a value of its properties.
    
       JavaScript Supported Data types below:
    
       Boolean
       Null
       Undefined
       Number
       BigInt
       String
       Symbol
       Object
    
    
       # JSON doesn’t support undefined but, JavaScript Object does. Instead of undefined JSON supports null.
    
       # You can assign a function as a value in JavaScript Object but not in JSON.
    
       # You can’t comment inside JSON. It just doesn’t support comment, it must be all JSON data, but you can comment inside JavaScript Object.
1 Like
  1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
    We have the problem that we need to store more than just one value and this cannot be done with strings or integers.

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

  3. What are properties in Javascript?
    Properties are expressions that access a certain information of some value.

  4. Which values do not have properties?
    The only values with no properties are “null” and “undefined”.

  5. How can we access properties in a value (two ways)?
    You can access properties by either by using a dot (“value.x”) or brackets (“value[x]”).

  6. What are methods?
    Methods are properties of a value that contain functions.

  7. What are objects?
    Objects are data structures that can contain up to a 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 are mutable which means that you can modify or rather update values.

  9. How do you define an object?
    You define objects by using braces as an expression followed by a list of properties. The properties all have a name followed by a colon and a certain value, for example:

let TestObject = {
fun = false;
event = [“waiting in line”]
};

  1. What can you say about the mutability of Javascript objects?
    Objects can be modified whereas strings, numbers, booleans etc. cannot.

SECOND PART:

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

  2. What are rest parameters?
    Rest parameters make it possible to accept any number of arguments without specifying about the exact amoung.

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

  4. What is serialisation and what is a use case of serialisation of data?
    Serialization means converting data structure into a so called flat description which allows you to store or send it.

  5. What is JSON?
    JSON stands for JavaScript Object Notation and is a popular serialization format.

  6. What are the differences between JSON and the way programmers write objects in plain Javascript?
    JSON doesn’t allow comments and everything is put between double quotes except basic data types like integers or booleans.

1 Like
  1. The sub-chapter (The Weresquirrel) has introduced a variety of events, which facilitates a complexity of information with different concepts, uncertainties, solutions, transformational triggers, and multiple values of all types. These problems cannot be solved with variable types such as strings or integers.

  2. The data type “arrays” are used to solve the problem of storing multiple values. Arrays are a list of values between square brackets, separated by commas. let num = [2, 4, 6, 8, 10, 12];

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

  4. Null and undefined are nonvalues which don’t have properties, if you try to access a property on them, you get an error. // TypeError: null has no properties

  5. Properties are accessed by using a dot in some instance value.x and square brackets in other instances value[x].

  6. Methods are functions that live on properties and act on the value they are properties of. Actually, commands which are used on values to manipulate them. The push method adds values to the end of an array, Etc;.

  7. Objects are a collection of attribute-related constants and functions. Objects tend to use names as their properties and store a fixed set of them.

  8. Objects are mutable and can be changed, but the primitives are immutable and cannot be changed.

  9. Defining an object: Objects are an unordered collection of related data, of primitive or reference types, in the form of “key: value” pairs. It’s a structure which allows us to group values, including other objects, to build more complex structures.

  10. Javascript objects properties can be changed, causing a single object value to have different content at different times. It’s mutability is versatile within its values.

Second Part–:

  1. New properties cannot be added to string variables because strings have built-in properties and specific related methods, as they are immutable the properties do not stick, therefore not permanent.

  2. Rest parameters are substitutes for a function, which accepts any number of arguments.

  3. skip.

  4. Serialization is a conversion of tangled memory addresses, which can be used for serializing (flattening for ease of transportation) the data.

  5. JSON is a serialization format. A data storage and communication format on the Web.

  6. Difference in using JSON and writing objects: JSON has a few restrictions wherein all property names have to be surrounded by double quotes. In using JSON only simple data structures are allowed and nothing involving computational computing. Comments are not allowed in JSON. All other functionalities allowed in writing objects are allowed. Therefore JSON and Objects are similar except for the few restrictions above.

1 Like

i will answer these questions after i finish reading the chapter. for now i have a basic question that i hope is appropriate for this thread.

when a function console.log’s information, is that information stored in the browser for other functions to access?

  1. He need a data structure for all the information.
    2)Array
  2. Properties are characteristic data of our study’s case.
  3. null, undefined
    5)value.property, value[property]
    6)Properties that contain function
  4. They are a list of value combined in a single one and put in an array
    8)Object can store a multiple type of value at the same time.
    9)It is a list of characteristic, value, useful for define a list of different object.
    10)It make object very useful for changing data during the run.

SECOND PART:
1)String are immutable. You can only substitute it with another one, not changing it.
2) Rest parameters are bound to an array,which contains all further arguments. This allows functions to allow any number of arguments. To add a rest parameter use three dots before the function’s last parameter.
3)
4)Objects and arrays are stored as bits holding addresses. These objects can be serialized into a data management notation, suitable for digital communications.
5) JavaScript Object Notation. It is widely used as a
data storage and communication format on the Web, even in languages other
than JavaScript
6)Only single expression are allowed in JSON. easier to transfer.

1 Like