Create a folder, "JS1"
Create THREE files (jsMain.html, jsFib.html, jsFizz.html). jsMain will link to the other two files.
Each file should ONLY USE JAVASCRIPT statements to create each page.
Need to use "prompt" and need to use javascript functions. "Cheating" is allowed by using "document.write()" to write html code.
Each page will begin with comments (guidelines):
<!--
name and brief explanation of page
-->
Followed by:
<script type="text/javascript">
all your code...
</script>
-
jsMain.html
should have a link to each of the two files along wiith an explanation of each operation (fibonacci & fizzbuzz).
-
jsFib.html
should prompt the user for a number, n
should call function Fib() that is called with n as an argument
Fib() should create and output n fibonacci numbers (0,1,1,2,3,5,8,13...)
[OPTIONAL] Use an array store the numbers.
-
jsFizz.html
should prompt the user for a number,n
should call function Fizz() that is called with n as an argument
Fizz() should generate the nummbers 1-n playing the game, FizzBuzz
Fib()
- using parameter, n
- generate n fibonacci numbers starting with the numbers 0 and 1
- each subsequent number is the sum of the previous 2 numbers
- sequence goes 0, 1, 1, 2, 3, 5, 8, 13
- sequence must be generated on the fly, not stored
- [BONUS] after generating & printing, store each number in an array and
print the array at the end (should be the same as what you already printed).
Fizz()
- using parameter, n
- generate the numbers 1-n
- if a number is divisible by 3 & 7, output 'FizzBuzz' and the number
- if a number is divisible by 3, output 'Fizz' and the number
- if a number is divisible by 7, output 'Buzz' and the number
- otherwise simply print the number
- sequence goes 1, 2, Fizz 3, 4, 5, 6, Buzz 7, 8, Fizz 9, 10, 11, Fizz 12, ...
- sequence must be generated on the fly, not stored