+ 2
What’s wrong with my JavaScript code?
I am trying to solve a javaScript pro question in the course and it wants me to return the average of three numbers. My code runs in every browser on earth but in this app it says ”no output”, when the output is clearly 6. It’s driving me crazy. Please help I need the xp XD. function average (a, b, c) { var avg = (a + b + c) / 3; return avg; } average (3,6,9); https://code.sololearn.com/c32tSH5B3PKg/?ref=app https://code.sololearn.com/WZRctn3nns3C/?ref=app
4 Respuestas
+ 3
You are writing your JavaScript code inside Java, please look into that.
+ 3
Cristina ɐuᴉʇsᴉɹƆ you must log the output.
var result = average (3,6,9);
console.log(result)
OR
console.log(average (3,6,9));
0
Cristina ɐuᴉʇsᴉɹƆ Java and JavaScript are two different languages. Select web or node.js if you want to write code using JavaScript, when coding on SoloLearn Playground/Code.