Achintya Jha
Achintya Jha

Reputation: 12843

Can't we write and execute JavaScript code in a file and see output in console?

I installed JavaScript development tools in eclipse and want to write code in eclipse IDE and see the result.Is it possible to see the result without the browser?

Upvotes: 2

Views: 76

Answers (1)

Deepak
Deepak

Reputation: 1066

You can execute a javascript code using nodeJS, Provided you are not using any API's that require a browser environment (i.e for example you should not use any DOM manipulating api's in your code).

Steps to follow:
1)Write your code using a simple text editor and save the file with ".js" extension
2)Install nodeJS software
3)open command prompt and execute the command - node filename.js

NodeJS is a javascript runtime built on Chrome's V8 Javascript engine.

Upvotes: 1

Related Questions