Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run JavaScript in a console like environment?

Tags:

javascript

I'm trying to follow the the examples here

http://eloquentjavascript.net/chapter2.html

and

print('blah');

Keeps trying to send to a physical printer when run in a browser. I just want console output.

like image 433
Hoa Avatar asked Dec 13 '22 05:12

Hoa


1 Answers

If you want something simple, the Chrome console will let you run JavaScript on the fly. To print text you can use console.log('blah'); And if you want to print multiple values, you can just list them all out as arguments (no need to concatenate) console.log("a", "b", "c", 1, 2, 3);

You can bring it up with control-shift i then select the console tab on the far right. And of course FireBug has a similar feature if you're more of a FireFox fan.

enter image description here

like image 105
Adam Rackis Avatar answered Jan 02 '23 12:01

Adam Rackis