Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
55
rated 0 times [  62] [ 7]  / answers: 1 / hits: 60026  / 12 Years ago, mon, july 23, 2012, 12:00:00

I'm trying to create a node.js app and



alert('Sample Alert');


is causing my program to crash. Node says




ReferenceError: alert is not defined




and then quits. I can use the alert function when running javascript on a regular html page, so I'm at a loss to understand why this is... Is this a separate module that I have to use with node.js?


More From » node.js

 Answers
16

The alert() function is a property of browser window objects. It is not really part of JavaScript; it's just a facility available to JavaScript code in that environment.



Try console.log(Hello World);


[#84078] Saturday, July 21, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
andrewb

Total Points: 259
Total Questions: 124
Total Answers: 90

Location: Ivory Coast
Member since Sun, Mar 7, 2021
3 Years ago
;