What would be a good way to test Javascript on a browser? Should there be a localhost in my computer? and how to create one?
-
8ctrl+shift+j -> use console as REPL for testing– RaynosCommented Jan 15, 2012 at 13:01
-
5have you tried jsfiddle.net ?– albertjanCommented Jan 15, 2012 at 13:01
-
21Closed as not a real question, yet there are 15 upvotes. Stop being elitists @Matt Fenwick and the rest of you who closed the question. Stop proliferating your attitudes of condescension on this site.– Mark C.Commented Jul 20, 2017 at 16:59
-
1Perfectly reasonable question that I arrived at from a google search. Now 45 upvotes. High time the founding fathers looked at the moderators remit and curtailed the actions of some of the over zealous ones. I had similar problems on the R forum. This sort of moderating risks stopping people asking questions. Despite what your primary teacher told you, seemingly on SE some questions shouldn't be asked.– jacanterburyCommented Nov 6, 2020 at 13:44
-
RunJS it's a JavaScript playground that runs your code and gives you instant feedback.– Luke HaasCommented Dec 16, 2022 at 11:54
3 Answers
Following is a free list of tools you can use to check, test and verify your JS code:
Hope this helps.
-
5PlayCode.io - online javascript editor With this you can quickly test code and write here for long time with comfort. Commented Mar 29, 2017 at 17:40
If you want to edit some complex javascript I suggest you use JsFiddle. Alternatively, for smaller pieces of javascript you can just run it through your browser URL bar, here's an example:
javascript:alert("hello world");
And, as it was already suggested both Firebug and Chrome developer tools have Javascript console, in which you can type in your javascript to execute. So do Internet Explorer 8+, Opera, Safari and potentially other modern browsers.
-
1IE8 and IE9 also have developer tools out of the box.. at least for me they had. Opera and safari have consoles as well.– EsailijaCommented Jan 15, 2012 at 13:10
-
Install firebug: http://getfirebug.com/logging . You can use its console to test Javascript code. Google Chrome comes with Web Inspector in which you can do the same. IE and Safari also have Web Developer tools in which you can test Javascript.
-
4or install node and use the node REPL from the command line– RaynosCommented Jan 15, 2012 at 13:03
-
1Remember this won't work in IE. If the OP is an IE user, he should quickly install Chrome/Firefox, or use a web-based solution like jsfiddle.net, as mentioned by the_ajp Commented Jan 15, 2012 at 13:09
-