DEV Community

Rajdeep Das
Rajdeep Das

Posted on

JavaScript Path Documentation of Handy Methods

  1. The find() method returns the value of the first element in the provided array that satisfies the provided testing function.
const array1 = [{id:'1',name:'test'}, {id:'2',name:'test2'}];
const found = array1.find(element => element.id === '1');
console.log(found);
Enter fullscreen mode Exit fullscreen mode

OutPut:

Object { id: "1", name: "test" }

Top comments (0)