Getting Started

  1. Download and install the latest Current version of NodeJS - from https://nodejs.org/en/download/current/

To test that it was installed and running properly, go to your terminal and run the command: node -v You should get the node version printed on your terminal, for example, v7.3.0

  1. Fork the repository - https://github.com/Code-Your-Future/JS-Core-1-Exercises and Clone it locally.

  2. Once you have the repo locally, go to the folder on your terminal and run node main.js

You should get Hello World printed on your Terminal.

Hello World

It is programming tradition that the first thing you do in any language is make it say "Hello world!". This is the first thing we'll do in JavaScript, using something called a console.log().

console.log()

When we ran the command node main.js - that did log to the console printing the words Hello World to the terminal.

Let's open the file main.js and investigate its contents

Exercises

  • What do you notice about the code? Anything you don't understand? Notice the semicolon, the dot, the parantheses - these are all elements of JavaScript Syntax

  • Try to console.log() something different, for example, Hello World. I just started learning JavaScript!. (run node main.js after each change and look at the output in the console)

  • Try to console.log() several things at once.
  • What happens when you get rid of the quote marks?
  • What happens when you console.log() just a number without quotes?

Node?

We ran our JavaScript using Node - Node is is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side. Wikipedia

Exercises What are other "places" where we can run JavaScript code?

results matching ""

    No results matching ""