Input() command in Javascript

Is there an equivalent of python command input() in Javascript?

It uses a dialog modal to which we supply prompt text and default return value,

user = prompt("Name?", "Not specified")

But when I put this into the editor, it shows a

ReferenceError: prompt is not defined

What kind of editor?

For me user = prompt("Name?", "Not specified") is working just fine on playcode.io and jsfiddle.net. Are you sure your testing environment is set up properly?

I was trying it within codecademy in the exercise.

How do incorporate this within JavaScript?

It should be present unless the engineers for that exercise don’t want it to be defined. Chances are if prompt does not work, then neither will alert or confirm.

What exercise are you on (please copy URL in location bar and paste into a reply)?