简体   繁体   English

未捕获的引用错误:未定义提示

[英]Uncaught Reference Error: prompt is not defined

here is my code这是我的代码

var person =prompt("Please enter your name");
console.log(person); 

output:输出:

Uncaught Reference Error: prompt is not defined未捕获的引用错误:未定义提示

I also tried我也试过

var person = window.prompt("Please enter your name", "Harry Potter");
console.log(person);

and output is:和输出是:

Uncaught Reference Error: window is not defined未捕获的引用错误:未定义窗口

Prompt and window are defined on the client-side and won't work on the server-side.提示和窗口是在客户端定义的,在服务器端不起作用。 To get around this problem, I think the link below would be helpful for you.为了解决这个问题,我认为下面的链接会对您有所帮助。

getting user input in nodejs 在 nodejs 中获取用户输入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM