Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ * Given two arrays: studentNames and studentAges, complete the following 2 steps. The values and lengths of these arrays will be modified when graded
Given two arrays: studentNames and studentAges, complete the following steps.
The values and lengths of these arrays will be modified when graded so do
not hard code your output. You do not have to follow the steps exactly, what matters
is that your output matches for a variety of inputs arrays
The length will always be greater than or equal to so do not worry about singularplural
There will not be students with the same age or name so do not worry about duplicates.
var studentNames John 'Jack', 'Jane', 'Julia', 'James';
var studentAges ;
EXPECTED OUTPUT USING PROVIDED ARRAYS:
There are students.
The oldest student is Julia who is years old.
STEP : In a sentence, log the number of students
STEP : In a sentence, log the name and age of the oldest student
: Clone the age array hint: slice
: Sort the cloned age array, preserving the order of our original array.
: Get the highest age from the age array
: Using the highest age from the sorted array, Find what index it was in the original age array
: Using the index, log the name and age of the oldest student
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started