Thursday, April 29, 2021

Javascript Practice 07: JS Hero - Multiple functions

 
Question: 

Define two functions. The first function a should return 'Hello a!' and the second function b should return 'Hello b!'.




Answer: 

function a () {

return 'Hello a!';

}; 

function b () {

return 'Hello b!';

}; 



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