A
A
andreevich2011-06-14 23:59:57
JavaScript
andreevich, 2011-06-14 23:59:57

Javascript getting data from console?

Good time.
Recently I came across an article on advanced options for outputting information to the console, but is it possible not only to output, but also to transfer data entered into the console by the user to the script?
[out of curiosity]
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2011-06-15
@k12th

Write myfunc({a: 12, b: 24}) in the console, and, lo and behold, you passed the data entered by the user to the function :)

M
Mikhail Davydov, 2011-06-15
@azproduction

There is no console as such in client-side JavaScript. There are namesases and methods that browser vendors use to display data for debugging - the methods are the same, but the data is displayed from browser to browser is different. Faetically there is "STDOUT", "STDERR", but no "STDIN". You can, of course, make a crutch using prompt(), customize the interface like javascript linux , or write an extension for a specific browser.
Node.js has full methods for working with the TTY terminal

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question