Answer to Question #311046 in HTML/JavaScript Web Application for Ram

Question #311046

The goal of this coding exam is to quickly get you off the ground with the array method every ()


There is a selecting going on for civil service centre candidates have to participate in a number of events and the candid pose quotes more than 75 points in every event will be selected


Given candidateList as input it contains objects with name of the candidate and array consisting of poet attitude in each given by the candidate


Write a JS program to,

. Filter the candidates who have score more than 75 points in every event.

. Log the consisting of names of the selected candidates in the console


Input:

. The input will be a single line containing an array of objects candidatesList

Constraints

.keys object should be given in quotes


Sample input

[{'name:'blake,'points':[76,98,88,84]},{'name':'james','points':[098,12,33]},]



Output

[Blake]


1
Expert's answer
2022-03-14T08:38:48-0400
function filterCandidates(arr){
   const result = [];
   arr.forEach(obj => {
      if(obj.points.every(x => x >= 75)){
         result.push(obj.name)
      }
   });
   console.log(result);
   return result
}



let arr = [{'name':'blake', 'points':[76,98,88,84]},{'name':'james','points':[098,12,33]},];
filterCandidates(arr);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS