DEV Community

Discussion on: JavaScript’s Filter Function Explained By Applying To College

Collapse
 
bojanorter profile image
bojanorter • Edited

For filtering like this,

let admitted = students.filter(function(student){
   return student.gpa > 3.2 && student.sat > 1900;
})

i would use arrow functions new in ECMAScript 6.

then this becomes

let admitted = students.filter(student => 
student.gpa > 3.2 && student.sat > 1900
})

Other than that, I liked your post.

Collapse
 
kbk0125 profile image
Kevin Kononenko

Yeah, it is always tough for me to decide which version to use, maybe I just need to start including the second version in comments :)