Multiple choice technology web technology

How do you create a function?

  1. function myFunction()

  2. function:myFunction()

  3. function=myFunction()

  4. myFunction()

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

function myFunction() is the correct JavaScript syntax for creating a function declaration. This syntax defines a function that can be called later. Option B incorrectly uses a colon, Option C uses an equals sign (variable assignment syntax without the function keyword properly), and Option D is just a function call without any declaration. JavaScript requires specific syntax rules for function definitions.