Array.Filter

Added in ES 2009.
Filtering all the items that contain the characters "ab"

const myArray = ['ab1','ab2','cd1','cd2']  
const myResult = myArray.filter(member => member.match(/ab/);



© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext