0

All system level javascript engines(Node, Rhino, etc...) implement the commonjs specification that states that all code must be wrapped in an anonymous function. Due to this, experiments related to the context this does not yield the same results as they would in a browser.

For example, the following if run under node; would yield a different result than when it is run in Firebug:

var inner;
inner = 'inner';
this.inner = 'overriden';
console.log(inner); // node: inner // firebug: overriden

For me, its more efficient to do these experiments in my Ubuntu terminal than in the browser. Is there a js runtime that can emulate the browser's runtime as it is in my terminal?

asked Apr 25, 2013 at 7:26

1 Answer 1

1

I found phantomjs to be most compatible to browser specific javascript. . This could be probably because phantomjs is itself a headless browser. However it gives a commandline console and a way to run js scripts from the commandline.

answered Apr 25, 2014 at 7:33
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.