Put in order · JavaScript and TypeScript course · Module 1: JavaScript Basics

Structure of a Code Block in a Function

Arrange the elements of a code block structure in a JavaScript function:

Items to put in order

  • }
  • return result;
  • local variable declarations
  • statements (logic)
  • function name() {
Show the answer

Correct order:

  1. function name() {
  2. local variable declarations
  3. statements (logic)
  4. return result;
  5. }