Witam,
Chciałbym poćwiczyć funkcję w kompilatorze online ale wygląda na to, że nie bardzo wiem jak wyświetlić wynik funkcji. Mam taki kod:
const numbers = [20, 30, 40];
function someFunc(numbers) {
let sumall = 0;
for (let i = 1; i <= numbers.length; i++) {
sumall += i;
return sumall;
console.log(someFunc());
po naciśnięciu Run dostaję :
node /tmp/ab2DRNbMrp.js
/tmp/ab2DRNbMrp.js:15
console.log(someFunc());
^
SyntaxError: Unexpected end of input
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Czy mógłby mi ktoś powiedzieć co robię nie tak? Nie wiem czy sama funkcja będzie działała poprawnie ale do tego będę dochodził później.