Make sure to navigate to JDK\bin. Go to the terminal where your javascript is saved and you can run using > phantomjs filename.js. Read More » Simply use the default settings. For instance, if you were to run a Python script you would type python filename.py or if you wanted to run a C program make filename then ./ filename. You can run this task manually from Tools > Build. 2.For MAC type terminal in the spotlight and press Enter. Launch Terminal to begin.. More Less. javascript – How to get relative image coordinate of this div? If run-in-terminal can't determine launcher or file_path (file not saved and has no name) it will do start-terminal-here. In the comments of “How to start XAMPP in Terminal Mac OSX”, there were suggestions about using alias for the command. Write the script in the file using an editor. Technically, Node.js isn't proper JavaScript as we know it, since there isn't a Document Object Model (DOM). How do you run JavaScript script through the Terminal? Is it correct? Passing a txt file as an argument in JavaScript, Issues running haxe application in osx terminal with createjs library, How to validate an email address in JavaScript. @OliverWeiler it's not as easily applicable in general situations as some other languages, but I do believe it can have it's applications outside of web pages :). in Terminal.app. .You should put the path to phantomjs installation folder on the top of your javascript file. and execute your js file by giving a command. If you are on a Windows PC, you can use WScript.exe or CScript.exe. November 20, 2017 It lets you enter commands in the command line. However, it can also be installed on your local computer, providing a relatively simple way to run Javascript and get the results without using a browser. Learn how to code in Java on a Mac: Compiling Java programs from Terminal in OS X As an aside, some people prefer to create code directly in the Terminal (rather than use an SDK). If you've got hold of a script which was written for a web page, you may need to wrap or modify it somewhat to allow it to accept arguments from stdin and write to stdout. Include your .js file into an .htm(l) page via the