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?

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.