Description
(5 points) Start with an array called table. The array should have numbers between 1 and 10.
- (30 points) Use table to create the following: –
- Set of multiples of 5 between 1 and 51. Name it fiveTable
- Set of multiples of 10 between 1 and 101. Name it tenTable
- Set of squares of numbers in table. Name it squaresTable
- (10 points) Get the odd multiples of 5 between 1 and 100. 5, 15, …
- (20 points) Get the sum of even multiples of 7 between 1 and 100. 14 + 28+…
- (15 points) Use currying to rewrite the function below: –
function cylinder_volume(r, h){
var volume = 0.0;
volume = 3.14 * r * r * h;
return volume;
}
Use r = 5 and h = 10 to call your curried function.
- (15 points) Use the following code to take advantage of closure to wrap content with HTML tags, specifically show an HTML table consisting of a table row that has at least one table cell/element. You can use the console to output your results.
makeTag = function(beginTag, endTag){
return function(textcontent){
return beginTag +textcontent +endTag;
}
}
- (5 points) Following instructions
- (Extra credit) Do the generic version of questions 3 and 4 – first odd or even and then the number whose multiples (in range 1 to 100) you want.