Digital Media Technology (Spring 2009) / Extra Exercises

If the "default" exercises seem too much, try these. Ask the instructor for help!

JavaScript: Make function sum(a,b)

Do a JavaScript function, which sums two variables and returns the sum. Try what happens with the following parameters: 1, 0.1, "a", "". A convenient way to test is alert(sum(1,2)). Try also to call the function with Firebug.

JavaScript: Make function average(table)

Do a JavaScript function, which calculates the average of values inside the table given as parameter.

JavaScript: Try out table properties

JavaScript table can do a lot!

PHP: make function sum(a,b)

Do a PHP function, which sums two variables and returns the sum. Try what happens with the following parameters: 1, 0.1, "a", "". Test the function with echo sum(a,b);

PHP: Make function average(table)

Do a PHP function, which calculates the average of values inside the table given as parameter.