Last active
October 22, 2018 15:05
-
-
Save AhmedHelalAhmed/8a3516a3de27f1554b54f436b3476138 to your computer and use it in GitHub Desktop.
script to get certain value from array of objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const inputs=[ | |
| { | |
| macAddress: 'A', | |
| flag: false, | |
| }, | |
| { | |
| macAddress: 'B', | |
| flag: false, | |
| }, | |
| { | |
| macAddress: 'C', | |
| flag: true, | |
| }, | |
| ]; | |
| let output=[]; | |
| inputs.forEach(function(input) { | |
| console.log(input); | |
| var key = input.macAddress; | |
| var value = input.flag; | |
| output[key]=value; | |
| }); | |
| console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment