Enter any number as the PING, and we will return a PONG by counting from 1 to your number with three exceptions:
- Numbers divisible by 3 are replaced with "ping"
- Numbers divisible by 5 are replaced with "pong"
- Numbers divisible by 15 are replaced with "ping-pong"
- If user enters not-a-number (i.e. letters and/or signs), the program will not work and display a message requesting to enter an actual number.
- input: hello
- output: "Please enter a number and try again!"
- If user enters a number that is less than the first translatable number (e.g. 3 to Ping), the program will simply count up to the entered number.
- input: 2
- output: 1,2
- If user enters a number that is equal to the first translatable number, the program will count up to the inputted number and replace it with the corresponding word.
- input: 3
- output: 1,2,Ping
- If user enters a number, the program will count up to the inputted number while returning Ping, Pong, or Ping-Pong for numbers divisible by 3, 5, or 15 respectively.
- input: 5
- output: 1,2,Ping,4,Pong
- If user enters a number, the program will count up to the inputted number while returning the in-divisible numbers as it is, while returning Ping, Pong, or Ping-Pong for numbers divisible by 3, 5, or 15 respectively.
- input: 6
- output: 1,2,Ping,4,Pong,6
- If user enters a number, the program will count up to the inputted number while returning the in-divisible numbers as it is, while returning Ping, Pong, or Ping-Pong for numbers divisible by 3, 5, or 15 respectively.
- input: 15
- output: 1,2,Ping,4,Pong,Ping,7,8,Ping,Pong,11,Ping,13,14,Ping-Pong.
- Go to https://github.com/anandangalig/ping_pong.git
- Download this repository onto your local machine
- Open the files in your favorite text editor to see the code
- Open index.html in your web-browser to play the game
No known bugs reported so far. If you find one, please let me know via email at anandangalig@gmail.com
- Jquery
This game is licensed under the MIT License agreement.
Copyright (c) 2016 Anand Angalig