Console program


#1

Does anyone know if it is possible to create text-based program where a user interacts with the console at the bottom of the screen?

One of my students saw that they could put text into the console, but can’t figure out how to read what is being put into that console. I suggested using the “prompt” command but it seems like it should be possible to do directly from the console. I’ve done some googling on the subject but cannot seem to figure it out.

Ideas @jkeays @hwalden @frank_w_lee???

KT


#2

@kaitie_o_bryan It is possible to do it. Although I haven’t tried in the AppLab environment. You are correct about using prompt. The program will then accept the input from the variable provide a result based on the entry. Example to follow soon.


#3

@kaitie_o_bryan I think I’d encourage them to make their own simulated “console box” at the bottom of their screen using a combination of prompt and the text element.


#4

Code: https://studio.code.org/projects/applab/Wb0ePU_lRgYlA4DW5TBiqw


#5

Sorry, all I could find was about the “prompt” command, used like so:


var x = prompt(“How old are you?”);
if (x > 150) {
console.log(“dang, u is old”);
}