+ 1
Why is it undefined?
I've been working on a code that takes specific inputs, but at the end of the response to each input, it says undefined. Why is this? https://code.sololearn.com/WvAUyr3eHe9E/?ref=app
3 Answers
+ 4
https://code.sololearn.com/WyeHbvdzIfpO/#js
CHANGE:
document.write(browser());
TO:
browser();
Basically, what's happening is you're feeding the function into the document.write() function, and it isn't properly returning anything to that function, so it's undefined value that's being printed with document.write(). The other sentences were printed during the function execution, which is why it gets printed first and then undefined.
0
Thank you!