Coder Social home page Coder Social logo

javascript-loops-timers-cw's Introduction

JavaScript Loops and Timer Events - Classwork

Find the Largest Number in the Array

Write a JavaScript conditional statement to find the largest of the five numbers from the array below. Use an alert box to show the result.

const myNumberList = [12, 2112, 9000, 1999, 24];

Exercise 1: While/For Loops

  • Create an empty name_array
  • Ask the user Enter a word. Enter 'q' to quit. Add each word they enter to the array
  • Create a while loop that will keep asking for words to add to the array until they enter 'q'
  • When the user enters 'q' use a for loop to print each word from the array
  • NOTE: Your code should handle the case of the entered quite letter Q

Exercise 2: Loops - FIZZBUZZ

FIZZBUZZ is a classic Programmer's challenge often used as part of job interviews.

User inputs the ending value (e.g. 100)

Your code should start at 1 and then iterate each number up to the maximum

  • If the current number is evenly divisible by 3 you should print "FIZZ" and the number
  • If the current number is evenly divisible by 5 you should print "BUZZ" and the number
  • If the current number is evenly divisible by both 3 and 5 you should print "FIZZBUZZ" and the number
  • Otherwise, just print the number to the console

Timer Challenge 1:

Animate the included sprite images of 'guy' images. Start with an initial image of guy1.png then every .5 second (500 ms) update the image to the next one in sequence. Once you reach image guy9.png start over with the guy1.png image.

SUPER MARIO Challenge 2:

Animate Mario walking to the left and right by pressing the left and right arrow keys (HINT: implement event handler(s) for handling the key presses)

javascript-loops-timers-cw's People

Contributors

kevin-codecrew avatar erhodes3 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.