Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Study</title>
- </head>
- <body>
- <script>
- `use strict`
- const maxColor = 3;
- const cRed = 0;
- const cGreen = 1;
- const cBlue = 2;
- let color = 0; // 0 - Red, 1 - Green, 2 - blue
- do {
- if (color == cRed) {
- alert('Red');
- }
- else if (color == cGreen) {
- alert('Green');
- }
- else if (color == cBlue) {
- alert('Blue');
- }
- else {
- alert('ERROR: Unknown color!');
- }
- ++color;
- color %= maxColor;
- //if (color > maxColor) {
- // color = cRed;
- //}
- //Red - Green - Blue
- // Blue [ Red ] Green
- // Red [ Green ] Blue
- // Green [ Blue ] Red
- // Blue [ Red ] Green
- } while (confirm('One more color?'));
- //let color = 'Blue';
- //do {
- // alert(`Current color is: ${color}`);
- // if (color == 'Red') {
- // color = 'Green'
- // }
- // else if (color == 'Green') {
- // color = 'Blue'
- // }
- // else if (color == 'Blue') {
- // color = 'Red'
- // }
- //} while (confirm('One more color?'));
- console.log('Job is DONE! :)');
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment