+ 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

20th Nov 2017, 7:55 PM
jacksonofgames 28
jacksonofgames 28 - avatar
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.
20th Nov 2017, 8:03 PM
AgentSmith
0
Thank you!
20th Nov 2017, 8:01 PM
jacksonofgames 28
jacksonofgames 28 - avatar