Why output of this code is nothing? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2
18th Mar 2021, 10:17 PM
šŸ•øcarpe diemšŸ•ø
šŸ•øcarpe diemšŸ•ø - avatar
3 Respostas
+ 3
Hi! because you didn't write an output statement to the screen or to the console. document.write() or console.log()
18th Mar 2021, 10:31 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Yep ^^ this : console.log(sum(2,3));
18th Mar 2021, 10:43 PM
Tarantino
Tarantino - avatar
+ 2
šŸ•øcarpe diemšŸ•ø easy way to do this based on your own code. function sum(x, y){ result = x + y; return document.write(result); } sum (2, 3); function sum(x, y){ result = x + y; return console.log(result); } sum (2, 3); which will display in the html viewer.
19th Mar 2021, 12:57 AM
BroFar
BroFar - avatar