简体   繁体   中英

Cannot run Javascript code on Atom editor

Atom is not able to run javascript code for some reason, I have tried both packages such as atom runner and atom script with no success. I have Node JS installed on my computer and javascript package installed on Atom, I have no idea why it does not work. Here is the code which is returned after trying to run a javascript prompt.

 C:\Users\artisan\Desktop\hi.js:1
(function (exports, require, module, __filename, __dirname) { var hi = prompt("wt");
                                                                       ^

ReferenceError: prompt is not defined
    at Object.<anonymous> (C:\Users\artisan\Desktop\hi.js:1:72)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

prompt() is a function which is implemented by Web Browsers. In serversided JS you can't use this function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM