Git Product home page Git Product logo

welcome-to-javascript's Introduction

Welcome To Javascript: A JavaScript Coding Exercise

Today, we are starting our journey into JavaScript. For this assignment, you will be making a program that demonstrates some JavaScript fundamentals.

Objectives

  • Ensure your development environment is setup
  • Practice creating variables
  • Practice working with user input

Requirements

Create your project using app-app with the beta stack

Remove all the code inside main.js and start with a fresh and empty file.

  • Create a new app that does the following.

    • Practice Creating Variables

      • Create a variable that stores the numberOfCupsOfCoffee that you drink every day (even if that is zero).
      • Create a variable called fullName and set it equal to your full name.
      • Use console.log and your variables, numberOfCupsOfCoffee and fullName to output all three on one line.
    • Practice Getting Input From the User

      • Ask the user for their name and store it in a variable named userName. (use window.prompt to get input from the user)
      • Console log a greeting to the user, using their name.
    • Converting String Input Into Numbers

      • Input two numbers from the user. Use window.prompt twice, once for each prompt/number. Convert each resulting string from window.prompt to a float using parseFloat. Save the first value in a variable named firstOperand and the second value in a variable named secondOperand.
    • Doing Math

      • Add the operand variables from above and save the results in a variable named sum.
      • Subtract the secondOperand variable from the firstOperand variable and save the results in a variable named difference.
      • Multiply the operand variables and save the results in a variable named product.
      • Divide the firstOperand by the secondOperand and save the results in a variable named quotient.
      • Find the remainder when one operand is divided by the other and save the results in a variable named remainder.
      • Use console.log to present the user, in a meaningful way, each of the values for the sum, difference, quotient, product, and remainder variables. (e.g. perhaps one of your outputs is similar to If you add 4 and 5 you get 9 if 4 and 5 were the input)
    • Using Arrays

      • Use this page to generate a array of random numbers.
      • Place these numbers into a properly formatted array named numbers.
      • Determine the following. Use JavaScripts for loops to your advantage.
        • In a variable named smallest, find the smallest value in the array
        • In a variable named largest, find the largest value in the array
        • In a variable named sum, find the sum of all the values in the array
        • In a variable named average, find the average of all the values in the array

welcome-to-javascript's People

Contributors

colterlena 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.