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.
Read the findIndex documentation on MDN. Explain the difference between findIndex
and indexOf
. Provide an example to enhance your response.
Add your response here...
The callback that you provide to forEach, filter, or map can include up to three parameters.
const arr = ['a', 'b', 'c', 'd'];
arr.forEach((param1, param2, param2) => {
});
What values will be provided to those three parameters? To support your response, provide an example of how you might use all three parameters to do something.
Add your response here...
According to our style guide (adopted from AirBnb), it is recommended that you only use array higher-order functions like forEach
instead of for
loops.
What do you see as the benefit of doing this?
Add your response here...
Below is a regular expression that can be used to identify emails. Explain how it identifies the three portions of an email!
/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/
Tip: Visit https://regexr.com/ to learn Regex and to help understand regular expressions.
Add your response here...
Imagine you are teaching a brand new programmer a brief lesson about callback functions. Your lesson should have the following components:
- An explanation of the concept with an analogy ("A callback function is a ... It is like a ...")
- An example of the syntax for a higher-order function that accepts a callback.
- An explanation of the syntax using the terms callback, higher order function
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.