Giter Club home page Giter Club logo

introtojavascripthomework's Introduction

Intro to Javascript homework

Objectives

  • Learn how to create and run a .js file using your text editor and the terminal

  • Put your understanding of Javascript vocabulary to use by assigning values to variables and by using expressions

Directions

  • Fork and clone this repo to your local machine ( in that order )

  • cd into your cloned directory and then create an app.js file

  • Before you write any code yourself, open your directory in your text editor and then copy this snippet of code and paste it into your app.js file:

var a = 22;
var b = 10;
var c = a + b;

console.log(c);
  • Then go back to your directory in the terminal and run this command:
node app.js
  • Notice how console.log(c); allows you to log of the value of the variable in the terminal by allowing node to execute your code

  • Now that you get the basics of how to execute code with node and see an output in the terminal, use javascript mathematical expressions to assign values to variables using all of the operators in this documentation except for "Exponentiation (**)" MDN Javascript mathematical operators

  • An example of this is :

var example = 2 + 2;
console.log(example);
  • After you create a new variable and add your console.log(); statement, run the app.js file with node and see the output. Run your app.js with node every time you add a new variable/console.log pair. When you see the output, take mental note of what the mathematical operator did, and then add a comment in your app.js file above the statement you are describing.

Example:

// The mathematical operator '+' is how javascript adds two values together
var example = 2 + 2;
console.log(example);
  • Go through that same process for all of the mathematical javascript operators (again, except for Exponentiation (**)) Until you have a comment, variable, and a console.log(); for each of the javascript mathematical operators.

  • If you want to get more comfortable with git, after every comment, variable, and console.log(); combination you create, you can add and commit your changes with descriptive commit messages explaining what you did at every step.

  • After you finish that, git add, git commit, git push. Then (from your fork of this repo on github.com) send a pull request.

STRETCH GOAL

//Math.pow(a,b) in javascript returns a to the power of b (in this case 2 to the power of 2)
var a = Math.pow(2, 2);
console.log(a);

introtojavascripthomework's People

Contributors

akyunaakish avatar d-stew avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.