-1

I'm a beginner at trying to learn web development. I currently downloaded node from the nodejs.org website and also downloaded Sublime Text 3 from the website as well.

My code for sublime is as follows:

$ node
console.log("Who's you're daddy?");

When I try to run it on node.js I get an error that says:

"Syntax Error, Unexpected Identifier."

This is literally step one and I'm already messing up. How have I set this up wrong?

idleberg
  • 12,634
  • 7
  • 43
  • 70

1 Answers1

1

From What you are trying to do seems like you want to print "Some String" in the console using nodejs.

In nodejs you can create a javascript logic first and then you can execute that logic using node.

  • Create a file somefile.js
  • Write following code in the file:

    console.log('Who's your daddy?');

  • In terminal and execute:

    node /location/of/the/file/somefile.js

It should print 'Who's your daddy?' in the console.

To learn more about nodejs and to get started you can refer to How do I get started with Node.js

Community
  • 1
  • 1
Mohit Tater
  • 453
  • 1
  • 6
  • 10