Created
January 8, 2020 13:48
-
-
Save colabottles/3afac46f0e7425a94c2da082adae84ad to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/fequfof
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <style id="jsbin-css"> | |
| * { | |
| box-sizing: border-box; | |
| font-size: 1rem; | |
| line-height: 1.5; | |
| } | |
| body { | |
| font-family: 'Open Sans', Arial, Helvetica, sans-serif; | |
| margin: 0 2rem; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <p class="sandwiches">Tuna</p> | |
| <p class="sandwiches">Ham</p> | |
| <p class="sandwiches">Turkey</p> | |
| <p class="sandwiches">PB&J</p> | |
| <script id="jsbin-javascript"> | |
| var sandwiches = ['turkey', 'tuna', 'ham', 'pb&j']; | |
| // logs 0, tuna, 1, ham, 2, turkey, 3, pb&j | |
| sandwiches.forEach(function (sandwich, index) { | |
| console.log(index) // index | |
| console.log(sandwich) // value | |
| }); | |
| // Skip "ham" | |
| // logs 0, tuna, 2, turkey, 3, pb&j | |
| sandwiches.forEach(function (sandwich, index) { | |
| if (sandwich === 'ham') return; | |
| console.log(index); // index | |
| console.log(sandwich); // value | |
| }); | |
| </script> | |
| <script id="jsbin-source-css" type="text/css">* { | |
| box-sizing: border-box; | |
| font-size: 1rem; | |
| line-height: 1.5; | |
| } | |
| body { | |
| font-family: 'Open Sans', Arial, Helvetica, sans-serif; | |
| margin: 0 2rem; | |
| }</script> | |
| <script id="jsbin-source-javascript" type="text/javascript">var sandwiches = ['turkey', 'tuna', 'ham', 'pb&j']; | |
| // logs 0, tuna, 1, ham, 2, turkey, 3, pb&j | |
| sandwiches.forEach(function (sandwich, index) { | |
| console.log(index) // index | |
| console.log(sandwich) // value | |
| }); | |
| // Skip "ham" | |
| // logs 0, tuna, 2, turkey, 3, pb&j | |
| sandwiches.forEach(function (sandwich, index) { | |
| if (sandwich === 'ham') return; | |
| console.log(index); // index | |
| console.log(sandwich); // value | |
| }); | |
| </script></body> | |
| </html> |
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
| * { | |
| box-sizing: border-box; | |
| font-size: 1rem; | |
| line-height: 1.5; | |
| } | |
| body { | |
| font-family: 'Open Sans', Arial, Helvetica, sans-serif; | |
| margin: 0 2rem; | |
| } |
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 sandwiches = ['turkey', 'tuna', 'ham', 'pb&j']; | |
| // logs 0, tuna, 1, ham, 2, turkey, 3, pb&j | |
| sandwiches.forEach(function (sandwich, index) { | |
| console.log(index) // index | |
| console.log(sandwich) // value | |
| }); | |
| // Skip "ham" | |
| // logs 0, tuna, 2, turkey, 3, pb&j | |
| sandwiches.forEach(function (sandwich, index) { | |
| if (sandwich === 'ham') return; | |
| console.log(index); // index | |
| console.log(sandwich); // value | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment