The websites I am talking about - codecademy.com and tryruby.org.
My guess would be that the console is a simple div
with a key listeners "attached" to it. Whenever a user presses any key and submits it by pressing enter, the console just adds whatever he typed after the last letter in the div
and "moves" the >> [type here
part to last line of the div
.
However, I'm not sure if that's so simple, so I would like to know what do other people think. I believe that it would be too inefficient - especially when we are talking about situation where the whole console is too stuffed with the text - adding any sign to the last line and moving the rest of the text up then would take too much time for browser to process.
The commands are sent via AJAX to an actual Ruby interpreter, the explanation you provided is correct, but does not account for the fact that the commands provide any sensible results in the Ruby language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With