Anson Aştepta
Anson Aştepta

Reputation: 1145

I keep getting error when the loading JS file via Node.js

I am trying to get node.js working now therefore I try to write a simple test function in JavaScript and name it score.js.

var score = 61;

if (score >= 60)
    console.log("pass");
else
    console.log("failed");

I try to run this but this happenedenter image description here

How may i fix this issue?

Upvotes: 0

Views: 78

Answers (1)

mscdex
mscdex

Reputation: 106698

You have to execute your scripts using the node executable, like: node score.js. Otherwise Windows will try to execute your javascript file with Microsoft's JScript implementation, which is very different.

Upvotes: 2

Related Questions