Hi @Regis_Brickett, No the information is not accessible. It’s just printed out and not stored anywhere. It’s just a one-time operation.
Hope this clears your doubt.
Hi @Regis_Brickett, No the information is not accessible. It’s just printed out and not stored anywhere. It’s just a one-time operation.
Hope this clears your doubt.
1. Read the sub-chapter called The weresquirrel. What problems does this chapter introduce that cannot be solved with variable types such as strings or integers?
The problem of accessing multiple sets of numbers in a data set.
Variable types like strings and integers can only hold a single type of data.
2. What variable type can be used in order to solve the problem of storing multiple values?
Arrays can hold multiple values that can be easily accessible.
3. What are properties in Javascript?
Properties are hidden capabilities in a value that one can call for example .length and .color.
4. Which values do not have properties?
null and undefined.
5. How can we access properties in a value (two ways)?
The two main ways to access property in JavaScript are whit a dot and with square brackets.
6. What are methods?
Methods are a set of functions that manipulates or call out data from arrays.
7. What are objects?
Objects are data structures that are capable of containing an arbitrary collection of properties.
8. What problem do objects solve that cannot be solved with other value types we’ve learned so far (such as integer, string, array, boolean etc)?
Objects are special as they are able to hold as many different datatypes as we need.
9. How do you define an object?
Objects are a set of values inside [ brackets ] separated by a , comma.
10. What can you say about the mutability of Javascript objects?
The mutability of Javascript objects means that the values they contained can be changed.
SECOND PART:
1. Why can’t you add new properties to a string variable?
Strings are immutable. They do not store new properties.
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. What is serialization and what is a use case of serialization of data?
Serialization is used in JSON to compact data. JSON is used as a data storage and communication format on the web.
Serialization means it is converted into a flat description.
4. What is JSON?
JSON is 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?
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.
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.
storing multiple values, since it would be hard to retrieve the data inside them.
Arrays are the best solution to this problem because theyre spefically made for storing several values, and data is easily accesible
when it is stored inside an array.
Properties are expressions used to get information about a value, because almost every value has properties, you can check string lengths
and create loops based on that information, or based on any property, properties are a really powerful tool.
null and undefined dont have properties.
we can acces properties in two ways, using a dot and using brackets.
Methods are properties that contain functions.
An object is a value that contains a list a of properties.
9.I define an object as a book where you write things everytime you need to, but this one is a very important book that you wanto
keep upddated to keep your program running the way you want it to run.
1.Because JavaScript don’t give strings tthe same permissions that it gives to objects, so it wont let us add new values to strings.
2.This one was hard for me to understand, but seems to me thtat a rest parameter allows us to set any amount of values as parameters for our function or array.
4.Serialization is the act of giving a description to a chunk of data, where is it used, hmm im pretty sure just about anywhere some sort of
serialization is needed in order to keep data organized, i use serialization in my pc everyday, otherwise i wouldnt know what is what and it would be a mess.
5.Json is javascripts serialization format.
6.JSon is a more simple format, where you cannot really create programs or anything it is just meant for serialization.
These answers are really key. One of the biggest things I am learning with javascript is how it different from Python in scope. Javascript jumps around, where python you really move top to bottom. I will definitely want to practice javascript more in depth with parent/child functions.
Luckily data types/objects are similar to python.
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 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 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?
Arrays are one variable type capable of storing multiple values.
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?
Null and undefined are the exceptions that do not have properties.
5. How can we access properties in a value (two ways)?
Properties in a value can be accessed using a dot and the literal name of the property. e.g. array.length
Properties can also be accessed using square brackets, with the expression between the brackets being evaluated to get the property name. e.g. array[“length”]
6. What are methods?
Methods are properties that hold function values. These are special kinds of functions that only work on the value they belong to.
7. What are objects?
Objects are data structures that are capable of containing an arbitrary collection of properties. These are created using braces to contain a list key/value pairs separated by 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 are special as they are able to hold as many different datatypes as we need.
9. How do you define an object?
Objects are defined as any other variable, with the value being a list contained within braces.
10. What can you say about the mutability of Javascript objects?
The mutability of Javascript objects means that the values they contained can be changed. This is different to other datatypes such as strings, which will always keep the same value it was defined with.
SECOND PART:
1. Why can’t you add new properties to a string variable?
A string is not an object but a primitive type, so they are immutable.
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. 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?
JavaScript Object Notation is a serialisation format widely used for data storage and communication.
5. 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.
the wersquirrel introduces a large dataset. the numbers of variables that you would have to create to represent each event would be unruly to work with. you also have another boolean variable tied to each event.
arrays can be used to store multiple values in one variable.
properties are values that are stored within a property name. i like to think of it as a physical object. those physical objects have properties. a ball is round. round is a property. you could name that property “shape” … shape: round, elements in an array are also properties. the property names for each element is their index position.
null and undefined do not have properties.
you can access properties with dot or bracket notation.
a method is a property that contains a function that can alter the value of the property it is tied to.
objects are values that consist of arbitrary properties.
when you create an object you can add many values types in the same place: number, string, boolean. you can much more easily access the values you desire in that object regardless of the value type.
you can define an object like a variable. var x = {object}
it is impossible to change the value of a string, number, or boolean. they are immutable. the values in an object can however be changed.
you cant add new properties to a string value because string values are immutable.
rest parameters allow a fucntion to accept any number of arguments for the rest parameter. the function will include any arguments after but not before the rest parameter
serialisation allows us to transmit data contained in an object or array without sending the whole computer memory. it takes a complex object or array and flattens it. this is needed because properties dont actually store values. they only store the location of the values in the computers memory. serialisation is useful in accessing data at a later time or transmitting data to another location. when the serialized data is received it is then deserialized to recreate the object or array.
JSON is a serialisation format that is used as a data storage and communication format on the web. it is accepted by languages other than javascript.
in JSON all properties are in double quotes. also only simple expressions are allowed. you cannot include function calls or bindings in JSON format. it essentially can only be used to store immutable values.
The squirrelman needs each of his log entries to store a list of additional information. He can’t do that with strings and integers because they only hold a single type of data.
Arrays store multiple values.
Properties in JavaScript are expressions that access a property of some value, for example length of a string.
Null and undefined.
With a dot or with square brackets - object.property or object[“property”].
Properties that contain functions are generally called methods of the value they belong to, as in “ toUpperCase is a method of a string”.
Objects in JavaScript are variables that we use as collections of properties.
With objects we can group values of different types (boolean, strings…) and enter each group as an entry into an array.
We define objects using curly braces {} that contain a group of properties and values assigned to them.
In JavaScript objects and arrays are mutable which means their values can be changed unlike primitive values like integer, boolean, string which are immutable.
If we tried to add new properties to immutable variables such as strings JavaScript would not store those properties.
A function’s last parameter can be prefixed with … which will cause all remaining (user supplied) arguments to be placed within a “standard” JavaScript array. Only the last parameter can be a “rest parameter”.
4 If you want to save data in a file for later or send it to another computer over the network, you have to somehow convert it to a description that can be stored or sent. What we can do is serialize the data. That means it is converted into a flat description.
JSON is a format for storing and transporting data. JSON is often used when data is sent from a server to a web page.
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.
First part:
The weresquirrel introduces the concepts of objects, arrays and data collection and manipulation, which cannot be accomplished using variables such as strings and integers.
Arrays can be used to store multiple values
Properties in Javascript are variables inherent characteristics
Null and undefined don’t have properties
Methods are built-in functions used to execute specific tasks
Objects are collections of values/properties
Objects first solve the problems of mutability: integers, booleans and strings are immutable, and thus cannot be altered.
Another problem that objects address is the flexibility of data collection types. Arrays only accept values of the same type whereas objects allow for more flexibility. Integers and strings values can be stored within the same object for example.
Objects are defined by placing a list of properties separated by commas within curly brackets:
Object = {
propertyname1: property,
propertyname2: property,
propertyname3: property,
…};
Properties within objects can be changed and new properties can be assigned to values
Second part
New properties cannot be added to string variables because they are immutable
Rest parameters are used to create functions that accept unlimited number of arguments
Serialization is the process of converting an object into bytes that can be stored or transferred to files or memory
JSON stands for JavaScript Object Notation -It is a widespread serialization format commonly used for data storage and communication on the web
In JSON, property names are double-quoted and only simple data expressions are allowed
FIRST PART:
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?
Answer: He needs to store multiple values and data types that are unknown to start with.
What variable type can be used in order to solve the problem of storing multiple values?
Answer: Arrays and objects
What are properties in Javascript?
Answer: JS values have properties like the index of a value and the length of an array.
Which values do not have properties?
Answer: null and undefined
How can we access properties in a value (two ways)?
Answer: Access properties by using a dot or a square bracket
What are methods?
Answer: Properties of string values which contain functions that can be used to perform other operations on them…as in “toUpperCase is a method of a string”.
What are objects?
Answer: Objects are data structures that could contain a collection of constants and functions. They are in effect an arbitrary collections of properties that are created using braces to contain a list key/value pairs separated by a comma.
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)?
Answer: Objects allow developers to group numerous values (including other objects) to build more complex structures.
How do you define an object?
Answer: One way is to use braces as an expression {}. Ex: var person = {firstName:“John”, lastName:“Doe”, age:50, eyeColor:“blue”};
What can you say about the mutability of Javascript objects?
Answer: JS object mutability means the values within the object can be changed. However, if you want to make an object’s value immutable, you can define read-only properties by using the Object Constructor and adding “writable: false”. (i.e. Object.defineProperty(person, ‘born’, {value: ‘America’, writable: false});
SECOND PART:
Why can’t you add new properties to a string variable?
Answer: Values don’t stick to string variables because string variables are immutable.
What are rest parameters?
Answer: Rest parameters, denoted by placing “…” before the function’s last parameter, tell a function to hold and accept all further arguments.
What is serialisation and what is a use case of serialisation of data?
Answer: Serialisation of data refers to converting the data into a flat description, as opposed to it’s value being partially derived from the sequence of memory bits related to the place it’s stored. A use case for serialisation would be to send to another computer over the internet.
What is JSON?
Answer: JavaScript Object Notation that’s widely used for data storage and communication.
What are the differences between JSON and the way programmers write objects in plain Javascript?
Answer: In JSON, property names must be surrounded by double quotes and only simple data expressions are allowed (no function calls, bindings, or computation).
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?
What variable type can be used in order to solve the problem of storing multiple values?
What are properties in Javascript?
Which values do not have properties?
How can we access properties in a value (two ways)?
What are methods?
What are objects?
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)?
How do you define an object?
What can you say about the mutability of Javascript objects?
Why can’t you add new properties to a string variable?
What are rest parameters?
(Feel free to skip the sub-chapter of Math object and Destructing)
What is serialisation and what is a use case of serialisation of data?
What is JSON?
What are the differences between JSON and the way programmers write objects in plain Javascript?
1 -> Because of the fact we want to extract data seperate from a array, also having the possibilty to store that same data in a array in the right order
2 -> The variable data type called a Array we can use to store multiple values
3 -> A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure.
4 -> Null and undefined
5 -> value.x and value[x]
6 -> A method are ways to manipulate data structures as for example Arrays
7 -> Values of the type object are arbitrary collections of properties.
8 -> A variable thrue a object can contain sets of activities or code structures and can be changed if you wanted. The integer, string, array or boolean can only hold a value(s) or a outcome and can`t be changed
9 -> To put the code in curly braces you are defining a object and assign it with the = operator to a value
10 -> You can change their properties, causing a single object value to have different content at different times.
Second part:
1 -> The text inside it cannot be changed. If you have a string that contains “cat”, it is not possible for other code to change a character in your string to make it spell “rat”.
2 -> It can be useful for a function to accept and iterate any number of arguments.
3 -> (?)
4 -> That means converting data in flat description, in JSON it has the use case to store data and a communication format for the web
5 -> JSON stands for JavaScript Object Notation and is a serialisation format
6 -> 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.
Second Part:
Jacques requires a data structure that is more complex than a mere integer/string to keep both a daily log of all his activities and whether he has turned into a squirrel. He requires a variable that stores multiple values.
An array can be used to store multiple values, as can an object.
Properties are the values associated with a JavaScript object.
null and undefined
We can access them using dot notation (e.g. objectName.property) or bracket notation (e.g. objectName[“property”] also objectName[expression] where expression evaluates to a property name).
Methods are properties that contain functions which operate on the value that they belong. Example myString.toUpperCase & myString.toLowerCase also myArray.push() & myArray.pop() .
Objects are an arbitrary collection of properties.
Objects allow for unordered collection of properties.
Objects are defined as follows: let myObject = { //list of properties separated by commas };
JavaScript objects are mutable. Unlike the immutable number, string and Boolean variables, the properties of objects can be changed allowing a single object value to have different content at different times.
JavaScript will not store any new properties added to a string. Strings do have built-in properties but they are immutable.
Rest parameters are a type of argument/parameter to any number of arguments in the form of an array and use each element as an argument for the respective function.
Serialisation converts a variety of memory addresses for object data into a flat description. An example of a use case for this is if you need to save data in a file to be used later or shared over a network, the data can be converted to JSON format without having to share a description of all the memory addresses of the original computer that the data was sourced from.
JSON (JavaScript Object Notation) is a serialisation format in that it serialises relevant array and object data by converting it to a flat description.
In JSON
a. All property names in the object must be surrounded by double quotation marks
b. Only simple data expressions are allowed (i.e. no function calls, binding or anything that requires computation)
c. No comments are allowed in JSON
Part 2:
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 irregular occurrences of the transformation make him suspect that they might be triggered by something. Jacques has started keeping a daily log of everything he does on a given day and whether he changed form. With this data he hopes to narrow down the conditions that trigger the transformations. (Make it possible to handle large sets of data).
What variable type can be used in order to solve the problem of storing multiple values?
JavaScript provides a data type specifically for storing sequences of values. It is called an array.
What are properties in Javascript?
Properties are the values associated with a JavaScript object. Almost all JavaScript values have properties.
Which values do not have properties?
Almost all JavaScript values have properties, the exceptions are null and undefined
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.
What are methods?
Properties that contain functions are generally called methods of the value they belong to,
What are objects?
Values of the type object are arbitrary collections of properties. A JavaScript object is a collection of unordered properties.
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 store different datatypes, which means you can solve the problem you have when you need a more complex data storing
How do you define an object?
One way to create an object is by using braces as an expression. Inside braces you give a list of properties separated by commas. Each property is written as a name, followed by a colon and an expression that provides a value for the property.
let person = {name: “John”, age: 21};
What can you say about the mutability of Javascript objects?
You can change their properties, causing a single object value to have different content at different times. Basically the mutability of Javascript objects means that the values they contained can be changed. This is different to other datatypes such as strings, which will always keep the same value it was defined with.
Why can’t you add new properties to a string variable?
Values of type string, number, and Boolean are not objects, and though the language doesn’t complain if you try to set new properties on them, it doesn’t actually store those properties. As mentioned earlier, such values are immutable and cannot be changed
What are rest parameters?
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.
Rest parameters are bound to an array, which contains all further arguments.
(Feel free to skip the sub-chapter of Math object and Destructing)
3. What is serialisation and what is a use case of serialisation of data?
If you want to save data in a file for later or send it to another computer over the network, you have to somehow convert these tangles of memory addresses to a description that can be stored or sent. You could send over your entire computer memory along with the address of the value you’re interested in, I suppose, but that doesn’t seem like the best approach. What we can do is serialize the data. That means it is converted into a flat description.
What is JSON?
A popular serialization format is called JSON 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.
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.
SECOND PART:
1.The problem that we have introduced is finding a way of storing multiple different values and data in one variable.
2.To store multiple different values in a variable you would use a variable called an ‘Array’.
3.Almost all javascript values have properties, properties are expressions that access some property of some value.
4.Two values in javascript that do have properties are ‘null’ and ‘undefined’.
5.To access the properties in a value you can use either value.x or value[x]
6.Methods are actions that can be performed on objects.
7.Objects are the name given to the data structure that that contain and arbitrary collections of values.
To create an object you can use braces as an expression.
8.Object can incorporate all the different data types or the ones that we need, such as integers, string, array, boolean…
9.Objects are defined like any other variable then with a list of values within curly brackets,
eg var x ={ y:" “, z:” "}
10.Object values are mutable meaning they can be changed as a program runs meaning one objects output can vary, effecting possibly another object input value, making dynamic decisions as it runs, unlike a string value which keeps with what it was defined with unless specifically changed.
second part:
1.String values are immutable and would need to re defined to change their value, and so stay a constant.
2.Rest parameters are a useful function to accept any number of arguments. To write a function like this you would put 3 dots before the functions last parameter …parameter
4.Serialisation is the conversion of the data structures like objects and arrays into another format that can be sent across a network or just another computer in a data file.
5.JSON -JavaScript Object Notation, is widely used as a data storage and communication format on the web, even in languages other than javascript.
6.All property names in Json must be wrapped in double quotes, you cannot have function calls, bindings, or any computation as there is no logic inside the file
Excellent answers, It’s easy to understand. Please keep them like that
Carlos Z.
SECOND PART: