Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js Alert Causes Crash

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?

like image 810
gtmtg Avatar asked Jul 23 '12 18:07

gtmtg


People also ask

Does alert work in node JS?

The "ReferenceError: alert is not defined" occurs when the alert() method is used outside of the browser environment, most commonly in Node. js. The alert method is a method on the window object, which is only available in the browser. To solve the "alert is not defined" error, use the console.

Why you shouldn't use node JS?

js may be excessive, as its powerful features will be simply wasted. Server-side web applications with relational databases. The reason for Node. js poor performance in this case is that its relational database tools are not as advanced as those created for other platforms.

What are the problems with node js?

Problems occurring in Node. js application deployments can have a range of symptoms, but can generally be categorized into the following: Uncaught exception or error event in JavaScript code. Excessive memory usage, which may result in an out-of-memory error.

CAN node js handle high traffic?

As is, node. js can process upwards of 1000 requests per second and speed limited only to the speed of your network card. Note that it's 1000 requests per second not clients connected simultaneously. It can handle the 10000 simultaneous clients without issue.


1 Answers

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");

like image 66
Pointy Avatar answered Sep 29 '22 18:09

Pointy