본문 바로가기

salesforce certification

(47/60) A developer has the following array of student test grades:Let arr = [ 7, 8, 5, 8, 9 ];The Teacher wants to double each score and then see an array of the studentswho scored more than 15 points.How should the developer implement the request?

let arr = [ 7, 8, 5, 8, 9 ];

// a : filterBy is not a function
//let arr1 = arr.map((num) => (num*2)).filterBy((val) => ( val > 15 ));
// b : return error
//let arr1 = arr.mapBy((num) => (return num*2)).filterBy ((val) => return val > 15 ));
// c
let arr1 = arr.map((num) => num*2).filter((val) => val > 15);
// d : return error
//let arr1 = arr.filter((val) => (return val > 15 )).map ((num) => (return num *2));

console.log(arr1);

https://onecompiler.com/javascript/3ynnbj89f

 

3ynnbj89f - JavaScript - OneCompiler

let arr = [ 7, 8, 5, 8, 9 ]; // a : filterBy is not a function //let arr1 = arr.map((num) => (num*2)).filterBy((val) => ( val > 15 )); // b : return error //let arr1 = arr.mapBy((num) => (return num*2)).filterBy ((val) => return val > 15 )); // c let arr1

onecompiler.com