Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Basic questions regarding Node.js

In order to write code in Node.js do I need to download something and then use notepad++?

Can I use everything I learned in regular JS with node.js? For instance, Math.random, array methods etc?

1 Answer

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

Hi there.

Let me start by explaining what Node.js is. Node is a JavaScript Runtime Environment, it's not a web framework, but there're quite a few web frameworks written for it ( Express, Koa, etc). Prior to Node.js, the programmer only writes Javascript codes to be interpreted by the browser to add some dynamics to web pages. Node makes it possible to run Javascript code on a machine, client or server, in much the same way of how you run Ruby, Python, Java codes.

Now to answer your questions.

In order to write code in Node.js do I need to download something and then use notepad++?

No, to write a Node.js application means to write plain JavaScript codes; and since Notepad++ comes w/ JavaScript language support out of the box, there's no need to download anything extra.

Can I use everything I learned in regular JS with node.js? For instance, Math.random, array methods etc?

Not only you can, but you have to. Remember, Node.js isn't a new language, it's simply an environment to run your JS codes. A good mastery of JavaScript is the prerequisite for writing Node.js app.

Thanks really helped me comprehend because I kept asking when will i see it on a webpage but now I get. However, I have node command tool on my computer and I created the var name, set it equal to a prompt and it told me I couldn't use it. How do you use node.js to receive information from the user if you can't use prompt?