write a JS program to
input
output
input1
[{'name': 'Blake Hodges', 'points':[76, 98, 88, 84]}
output1
['Blake Hodges]
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
function main() {
const candidatesList = JSON.parse(readLine().replace(/'/g, '"'));
// Write your code here
}
function main() {
const candidatesList = JSON.parse(readLine().replace(/'/g, '"'));
// Write your code here
const candidates = candidatesList.filter((candidate) => {
if (candidate.points.filter((point) => point > 75).length === 4) return candidate
}).map((candidate) => candidate.name)
return candidates
}
Comments
Leave a comment