Created
January 13, 2020 14:24
-
-
Save cesarkohl/614cfb2c739a3aa07b5f8055ff9b8bd1 to your computer and use it in GitHub Desktop.
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
| var students = [ | |
| {name: 'adam'}, | |
| {name: 'brian'}, | |
| {name: 'charles'} | |
| ]; | |
| var student; | |
| for (var i = 0; i <students.length; i ++) { | |
| if (students [i] .name === 'brian') { | |
| student = students [i]; | |
| break; // avoid scrolling through the rest of the list | |
| } | |
| } | |
| console.log (student); // {"name": "brian"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment