This exercise is going to get us plenty of reps in with both writing functions, and navigating through arrays.
-
In this lab you'll notice two files, and i
ndex.html
file and anindex.js
file. The index.html
file is importing theindex.js
file and running its code. -
You can open the
index.html
file in your browser by navigating to his repo in terminal and typingopen .
if you're on a mac (if you're on windows, navigate to this folder in your file explorer, right click on theindex.html
file, select "open with" and choose your browser.) Once you open this file in the browser, open you JS console. You should see a bunch of console log errors that are undefined. -
The console logs are logging the functions we are expecting you to write. When they are written properly in the
index.js
file, the desired result should be console logged in the browser
-
Write an function called
sortCohortDesc()
that sorts theourCohort
array descending alphabetically by first name (Tina's name should be first). -
Write an function called
shortNames()
that filters theourCohort
array to only students whose full name is less that 15 characters. -
Write a function called
cohortSize()
that tells you how many students there are in theourCohort
array -
Write a function called
locateStudent()
that takes in an arugment of a student name in the form of a string, and returns that student out of theourCohort
array. -
Write an function called
phaseNames()
that iterates over thecoursePhases
array and returns a new array of thename
value from each object. -
Write a function that iterates over the
coursePhases()
array and returns all the objects with the language "JavaScript"
----------------------------------------------------------------->
-
Write a function called
allTheGabes
that iterates over theourCohort
array and returns the number of students with the first name "Gabriel" -
Write a function called
studentAndPhase() that iterates over the
ourCohort` array and returns a new array with each student name plus the string "is currently in Phase 1!" Example: [ "Erica Rojo is currently in Phase 1!", "Natalie Barba is currently in Phase 1!", "Joe Orekhov is currently in Phase 1!", "Tina Guliuzza is currently in Phase 1!", "Gabriel Rodriguez is currently in Phase 1!", "Shawna Akiona is currently in Phase 1!", "Charles Oneymem is currently in Phase 1!", "Melissa Funk is currently in Phase 1!", "Gabriel Miranda is currently in Phase 1!" ] -
Write a function called
sortPhasesByName()
that sorts thecoursePhases
array alphabetacally by thename
value on each object