如何在javascript中获取控制台输入? [英] How do I get console input in javascript?
本文介绍了如何在javascript中获取控制台输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前使用spidermonkey来运行我的javascript代码。我想知道是否有一个函数从控制台获取输入类似于python这样做:
I'm currently using spidermonkey to run my javascript code. I'm wondering if there's a function to get input from the console similar to how python does this:
var = raw_input()
或在C ++中:
cin >> var;
我已经看过了,到目前为止,我发现的是如何从浏览器获取输入
I've looked around and all I've found so far is how to get input from the browser using the prompt() and confirm() functions.
推荐答案
Good old readline();
Good old readline();
https://developer.mozilla.org/En / SpiderMonkey / Introduction_to_the_JavaScript_shell#readline()
这篇关于如何在javascript中获取控制台输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文