Skip to content

Instantly share code, notes, and snippets.

@debbysa
Created March 1, 2021 04:08
Show Gist options
  • Save debbysa/f6073af63f6fb7fdd7ad758013cbde8b to your computer and use it in GitHub Desktop.
Save debbysa/f6073af63f6fb7fdd7ad758013cbde8b to your computer and use it in GitHub Desktop.
// for loop
var numbers = [10, 20, 30, 40];
var sum = 0;
for (var i = 0; i < numbers.length; i++) {
sum += numbers[i];
}
console.log(sum); // hasilnya adalah 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment