Code Monkey home page Code Monkey logo

control_flow's Introduction

Intro JavaScript

Control Flow

Objectives
Apply knowledge of methods and types to solve small exercises
Play with control flow structures

Please try the following exercises in the Chrome console.

First complete all exercises from the JS Primitives lesson.

Exercises

  • Practice using prompt, confirm, and alert try the following. You may want to look them up on MDN.

    • Ask the user for the their firstName. Then alert it.
    • Ask the user "have we met before?". If true then respond "nice to meet you".
  • Get the temperature from the user and alert it back in Celsius.

  • Confirm if a user has three friends? Use a loop and prompt to collect the names of the friends. Alert back the names of the friends.

  • Prompt the user to give a word. Then alert back the number of vowels.

  • Write a loop to solve the following riddle. I am a number between 2 and 100. I am even and a multiple of 3. I end in 2. My digits sum to 9.

  • Hard: Generate a random number between 1 and 100, an integer and not a float. Prompt the user to guess the number. Continue prompting the user for a guess using a loop, telling them each time if the number is lower or higher. Alert correct when they guess the number.

  • Super Challenge: Given an array of friends

    var friends = [
                    "larry",
                    "moe",
                    "curly",
                    "huey",
                    "louie",
                    "dewey"
                    ]
    

    write a loop to alert them in some random order.

control_flow's People

Contributors

rycwilson avatar

Watchers

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