For guidance on setting up and submitting this assignment, refer to the Marcy lab School Docs How-To guide for Working with Short Response and Coding Assignments.
Watch this (10 minute video on JSON)[https://www.youtube.com/watch?v=iiADhChRriM].
Explain what JSON is and explain why the example below is not valid JSON.
{
name: "Zo",
isCool: true,
age: 28
}
Add your response here...
Explain what a pure function is. Use the example below to help you with your explanation, making sure to indicate why it is (or is not) a pure function. Feel free to add comments to the example to enhance your explanation.
const favoriteLocations = ["New York City", "Jersey City"];
const addBostonToList = (list) => {
list.unshift("Boston");
};
addBostonToList(favoriteLocations);
console.log(favoriteLocations);
Add your response here...
Check out the docs for the rest operator.
Explain what the "rest" operator ...
is and when you would use the rest operator in a function. Provide an example to enhance your explanation.
Add your response here...
You are building an app and have to store data about user profiles. Each user profile is represented by an Object with an id
, username
and password
like this:
{
id: 1234,
username: 'SpongeBob',
password: 'dandelion'
}
Now, imagine you had hundreds of these user profiles and you want to be able to find any one of those objects by its id
or username
. Would it be better to store all of those objects in an array of objects, or in an object of objects? Why?
Add your response here...
Imagine you are teaching a brand new programmer a brief lesson about while
loops. Your lesson should have the following components:
- An explanation of the concept, when it is appropriate to be used, and an analogy ("A
while
loop is a ... It is like a ...") - An example of the syntax for a
while
loop using a JavaScript code block (triple back ticks) - An explanation of the syntax using the terms
while
keyword, code block, and stop condition
Below, we've provided an outline for your response but feel free to modify it as you see fit.
Explanation of the concept with an analogy.
Check out this example:
// Add your example here
Explanation of the syntax.