Question:
Which value does x have after execution of the following code?
function hello() {
return 'Hi!';
}
let x = hello();
Answer:
'Hi!'
> This is a function declaration & not a function expression
> name of the function: hello
> parameter: () parameter is empty
> statement: return 'Hi!'; enclosed in curly brackets
> the function must have a return statement that specifies the value to return
> declared a variable x and initialized it with a value
> the value will be, the output we get when we 'call' the function hello()
No comments:
Post a Comment