Objective
In this challenge, we practice implementing inheritance and use JavaScript prototypes to add a new method to an existing prototype. Check out the attached Classes tutorial to refresh what we’ve learned about these topics.
In this challenge, we practice using arrow functions. Check the attached tutorial for more details.
Complete the function in the editor. It has one parameter: an array, nums. It must iterate through the array performing one of the following actions on each element:
The function must then return the modified array.
In this challenge, we practice creating objects. Check out the attached tutorial for more details.
Complete the function in the editor. It has two parameters: and . It must return an object modeling a rectangle that has the following properties:
Note: The names of the object’s properties must be spelled correctly to pass this challenge.
In this challenge, we learn about iterating over objects. Check the attached tutorial for more details.
Complete the function in the editor. It has one parameter: an array, a, of objects. Each object in the array has two integer properties denoted by x and y. The function must return a count of all such objects o in array a that satisfy o.x = o.y.
In this challenge, we practice using JavaScript classes. Check the attached tutorial for more details.
Create a Polygon class that has the following properties:
Note: The perimeter method must be lowercase and spelled correctly.
In this challenge, we learn about strings and exceptions. Check out the attached tutorials for more details.
Complete the reverseString function; it has one parameter, s. You must perform the following actions:
In this challenge, we practice using throw and catch statements to work with custom error messages.
Complete the isPositive function below. It has one integer parameter, a. If the value of a is positive, it must return the string YES. Otherwise, it must throw an Error according to the following rules:
In this challenge, we practice looping over the characters of string. Check out the attached tutorial for more details.
Complete the vowelsAndConsonants function in the editor below. It has one parameter, a string, s, consisting of lowercase English alphabetic letters (i.e., a through z). The function must do the following:
In this challenge, we learn about switch statements. Check out the attached tutorial for more details.
Complete the getLetter(s) function in the editor. It has one parameter: a string, s, consisting of lowercase English alphabetic letters (i.e., a through z). It must return A, B, C, or D depending on the following criteria:
Hint: You can get the letter at some index i in s using the syntax s[i] or s.charAt(i).
Update your browser to view this website correctly. Update my browser now