Find and replace value inside an array of objects javascript

Viewed 41759

I have an array of objects:

[
 {
    "enabled": true,
    "deviceID": "eI2K-6iUvVw:APA"
},
{
    "enabled": true,
    "deviceID": "e_Fhn7sWzXE:APA"
},
{
    "enabled": true,
    "deviceID": "e65K-6RRvVw:APA"
}]

A POST request is coming in with the deviceID of eI2K-6iUvVw:APA, all i want to do is to iterate the array, find the deviceID and change the enabled value to false.

How's that possible in javascript?

2 Answers
Related