Question:
Write a function echo that also returns the passed parameter. echo('Greta') should return 'Greta' and echo('CO2') should return 'CO2'
Answer:
function echo (input) {
return input;
};
> This is a function declaration & not a function expression
> name of the function: echo
> parameter: () parameter is input
> statement: return input; enclosed in curly brackets
> the function must have a return statement that specifies the value to return
No comments:
Post a Comment