Answer to Question #327044 in HTML/JavaScript Web Application for sandhya

Question #327044

The goal of this coading exam is to quickly get you off the ground eith the array method every().there is a selection going on for the civil service sector candidates have to participate in x number of events and, the condidates who score more than 75 points in every event will be selectedgiven candidatesList as input,it contains objects with the name of the condidate and an array consisting of points achieved in each event by the condidate.filter the condidates who have scored more than 75 points in every event

log the array consisting of the names of the selected candidates in the console

i/p:the i/p will be a siongle line containing an array with names of the selected candidates

constraints:keys of objects should be given in quotes

input:

[{'name':'Blake Hodges','points':[76,98,88,84]},{'name':'James Anderson','points':[0,98,12,33]},{'name':'Matthew Norton','points':[89,67,83,93]}]

output:

['Blake Hodges']


1
Expert's answer
2022-04-11T16:51:32-0400
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
    <script>
        let arr = [
            {'name':'Blake Hodges','points':[76,98,88,84]},
            {'name':'James Anderson','points':[0,98,12,33]},
            {'name':'Matthew Norton','points':[89,67,83,93]}
        ];

        everyArr(arr);

        function everyArr(arr) {
            let resArr = [];
            
            arr.map(item => {
                (item.points).every(point => point > 75) ? resArr.push(item.name) : '';
            })

            console.log(resArr);
        }
    </script>
</body>
</html>

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