How do you create a function?
-
function:myFunction()
-
function myFunction()
-
function=myFunction()
-
function=myFunction(){ }
B
Correct answer
Explanation
JavaScript functions are declared using the 'function' keyword followed by the function name and parentheses, with the function body enclosed in curly braces. Option B shows the correct syntax. Options A, C, and D use incorrect separators (: or =) instead of a space, which are not valid JavaScript function declaration syntax.