Page 165 - Computer Software Application TP - Volume 1
P. 165
COMPUTER SOFTWARE APPLICATION - CITS
1 Create a JavaScript function named greetUser that displays a greeting message on the webpage when
called.
2 Write a JavaScript function named printMessage that takes a string parameter message and logs the
message to the console.
3 Create a JavaScript function named printMultiplicationTable that takes a parameter number and prints the
multiplication table of that number up to 10. Use console.log() to display each multiplication result.
4 Write a JavaScript function that takes two numbers as parameters and returns their sum. Store the result
in a variable and log it to the console.
5 Create a JavaScript function named calculateArea that takes two parameters length and width and returns
the area of a rectangle.
6 Write a JavaScript function named calculatePower that takes two parameters base and exponent and
returns the result of raising the base to the exponent.
7 Create a function expression named isEven that takes a parameter num and returns true if the number is
even, otherwise returns false.
8 Define an arrow function named capitalizeString that takes a parameter as a string and returns the string
with the first letter capitalized.
150
CITS : IT & ITES - Computer Software Application - Exercise 41