Fix for-of loop example code

pull/168/head
Tanu singhal 5 years ago committed by GitHub
parent 07143be3b7
commit f8ba159f68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -178,7 +178,7 @@ for (const num of numbers) {
// adding all the numbers in the array
let sum = 0
for (const num of numbers) {
sum += sum + num // can be also shorten like this, sum += num
sum = sum + num // can be also shorten like this, sum += num
}
console.log(sum) // 15

Loading…
Cancel
Save