Share your repls and programming experiences

← Back to all posts
Why did it end in 'undefined'
kikibres (0)

Every time I run my code in console.log, after it runs through the code and puts out correct results, it still adds "undefined" at the end. Why is that? Is it normal in repl.it?

Commentshotnewtop
a5rocks (787)

Oh okay so I think it's because repl is running the js in the browser console, and since the code doesn't return anything, it returns undefined.

michielvanderblonk (0)

@a5rocks sure, but is there a way to return anything? The console is not a function. Returning anything results in SyntaxError: 'return' outside of function

a5rocks (787)

@michielvanderblonk I think a nodejs repl shouldn't have this problem.

AllAwesome497 (362)

hmmm. lemme see if i can get some help. Next time, can you post this in bugs or ask tho?