function positiveSum(arr) {
var total = 0;
for (i = 0; i < arr.length; i++) {
if (arr[i] > 0) { // if arr[i] es mayor a 0
total += arr[i]; // dar el total de la suma de esos arr[i]
}
}
return total; // return total
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter