Functions can take data as parameters. For example, let's make a function that will take a number as a parameter:
function func(num) {
}
Let's make the function square the passed number:
function func(num) {
console.log(num ** 2);
}
Let's test the function by calling it with different numbers:
func(2); // shows 4
func(3); // shows 9
Make a function that takes a number as a parameter and prints the cube of this number to the console.
Make a function that takes a number as
a parameter and checks if the number is
positive or negative. In the first case,
let the function output the text '+++'
to the console, and in the second
case, '---'
.