Different between filter() and find() in javascript

filter() and find() is a javascript method. only use an array. The find() method return a specific one and the filter() method returns more than one.

find() method:

const x = [12, 12,12,12,12,12, 22, 11, 1112, 221]; const y = x.find(res => res !== 12 );

console.log(y)

output: [22]

filter() method:

const x = [12, 12,12,12,12,12, 22, 11, 1112, 221]; const y = x.filter(res => res !== 12 );

console.log(y)

output: [ 22, 11, 1112, 221 ]