Javascript Practice 08: JS Hero - Function calls
Question:
1. Define a function greet returning the value 'Haydo!'.
2. Declare a variable salutation. Call the function greet and assign the result of the call to the variable salutation.
Answer:
function greet() {
return 'Haydo!';
};
var salutation = greet();
> Declared a function greet
> Called the greet function and stored the returned value in the variable salutation
> salutation now has a value of 'Haydo!'
Comments
Post a Comment