DEV Community

Rajdeep Das
Rajdeep Das

Posted on

2

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay