Question: java script question // Functions // //-----------// console.log(Functions); // 1. Write a function named 'greet' that greets the user. Make sure that you // call
java script question // Functions // //-----------// console.log("Functions"); // 1. Write a function named 'greet' that greets the user. Make sure that you // call it as well. // 2. Write a function named 'sumAndPrint' that takes two numbers as parameters, // adds them together, and prints the result to the console. // 3. Write a function named 'sum' that takes two numbers as parameters, // adds them together, and returns the result. // 4. Write a function named 'findSmallest' that finds the smallest number in // an array. For example, the answer for [23, 54, 3, 6, 4, 46] should be the // number 3. Note that the function should take an array as input data. // 5. Define and implement a function named 'everySecondElement' that takes as // input an array and returns every second element in a new array. For // example, everySecondElement([1, 2, 3, 4, 5, 6]) should return [2, 4, 6]. // Hint: one solution uses the % operator.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
