Git Product home page Git Product logo

javascript_selection_statements's Introduction

JavaScript_Selection_Statements

Exercise 1

  1. Initialize an integer to represent a favorite number and assign a value with a number of your choosing or you can assign a random number to this variable.
  2. Use window.prompt() to ask the user to input a number, and store the result in a variable
  3. Create an if-statement that if the guessed number is below the initial value, print out “too low”.
  4. Create an else-if statement that if the number is higher than the initial value, print out “too high”.
  5. Create an else statement that prints out “Congratulations!!!”.

Exercise 2

  1. Declare a variable named userInput2 (or whatever topic you’ll ask about) and set the value to window.prompt(“Whatever question you want to ask here”).
  2. Inside of the parentheses, ask a question on whatever (appropriate) topic you’d like.
  3. Create a switch-case statement with 5+ cases and a default case.
  4. Log a response to the console depending on the value of userInput2.

javascript_selection_statements's People

Contributors

tannerdrayton avatar

Watchers

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