moving all labs to old dir
This commit is contained in:
12
old/lectures/lec5/p1/task8.js
Normal file
12
old/lectures/lec5/p1/task8.js
Normal file
@@ -0,0 +1,12 @@
|
||||
sum = (...args) => {
|
||||
return args.filter(num => num % 2 !== 0).reduce((acc, num) => acc + num, 0);
|
||||
}
|
||||
sum = (...args) => {
|
||||
let total = 0;
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i] % 2 !== 0) {
|
||||
total += args[i];
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
Reference in New Issue
Block a user