FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

Just discovered: jsconsole.com




Just discovered jsconsole.com, an awesome way to quickly test out some javascript code.
So far I like jsFiddle to test out javascript code in the context of a html page and css styles, or cscript to run some javascript locally in a command prompt window.
jsconsole runs in your browser but works like a console, thus you just type or paste in javascript code and will see the output in the console. Like:

Code:
a = 1;
1
b = 3;
3
a + b
4


A nice feature is that you can paste in functions as well and execute those:

Code:
function addit(v1,v2) {
  return v1+v2;
}
addit(a,b);
4


A much nicer feature is that you can load any web page to make it available as a document in your javascript context:

Code:
:load [url=http://www.google.com]www.google.com[/url]
Loading url into DOM...
DOM load complete


You can also use that ":load" command to load any external scripts, or a javascript framework like jquery:

Code:
:load http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js]http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
Loading script...
Loaded http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js]http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js


Now we have the google page available as a document and jquery as a library we can easily find out ( programmatically ) the text of the two buttons on that page:

Code:
$("input").each( function() {if ($(this).attr("type") == "submit") { console.log($(this).attr("value")); }});
"Google Search"
"I'm Feeling Lucky"


Isn't hat just wow !?



1 blog comments below

thx.. I will have to look at this..
Possum on Fri Aug 28, 2015 5:52 am



FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.