-
-
Save dongjinahn/5bc6cd47d5b44000bfcd8a4ae7826706 to your computer and use it in GitHub Desktop.
tterwer
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
| let sum = 0; | |
| for (let i = 0; i < arr.length; ++i) { | |
| const item = arr[i]; | |
| sum += item.value; | |
| } |
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
| sum = 0 | |
| for item in arr: | |
| sum += item["value"] |
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
| let sum = 0; | |
| arr.forEach(function(item) { | |
| sum += item.value; | |
| }); |
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 sum = arr.reduce(function(acc, item) { | |
| return acc + item.value; | |
| }, 0); |
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 sum = arr.reduce((acc, item) => acc + item.value, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment