Question:
Define a function hello that returns 'Hello world!'.
Answer:
function hello () {
return 'Hello World!";
};
JS Function Syntax:
Keyword: function
Name of the function: hello
Parameters within Parentheses: ()
Body within Curly Brackets: { return 'Hello World!'; };
Note:
return statement determines the value the function returns
Always use semi-colons in your code to avoid errors
No comments:
Post a Comment