Test JavaScript Function in Node.js Interactive Console

I needed to test an old JavaScript function on a new website. If you have Node installed, here is a great way to do it from the interactive console:

eval(require('fs').readFileSync('./path/to/file.js', 'utf8'));

I got this from:
http://stackoverflow.com/users/71522/david-wolever on
http://stackoverflow.com/questions/5171213/load-vanilla-javascript-libraries-into-node-js

This entry was posted in JavaScript, Snippets, Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *