Quiz: Organizing Code

Try this self-check quiz to test your knowledge!

Why would we organize code using Functions?

To improve readability of code by grouping functionality into discrete code blocks. To make maintenance easier by containing and isolating logic. To improve debugging by creating authoritative code blocks that handle one specific feature. To facilitate more complex algorithms. All of the above are reasons for organizing code using Functions.

What command is used to declare a Function in JavaScript?

def function fnc subroutine The command function is used to declare a Function in JS.

What two kinds of objects can go between the parentheses of a Function declaration?

parameters setters arguments getters The parentheses in the declaration of the Function can contain parameters and/or arguments.

What command sends data back to the code that called the Function?

respond dispatch update return The return command sends data back to the code that called the Function.

True or False: JavaScript parameters can have default values specified in the Function declaration?

true false True: Default Parameters are possible as of ECMAScript 6.

What command is used to declare a local variable in JavaScript?

var local let loc The command let is used to declare a local variable in JS.

What is do we call the context of the code (including all known object references) as it is executed by the interpreter?

context library scope platform The word "scope" indicates the context of the code as it is executed.

True or False: Variables declared with let can be used outside of the code block where they are declared?

true false False: Variables declared with let do not exist outside of the code block where they are declared (although they can be used in child code blocks of the block where they are declared).

How are code blocks identified?

{ } ( ) [ ] < > The curly braces ({ }) indicate a code block in JavaScript.

Visit Quiz Online

The quiz on this page has been removed from your PDF or ebook format. You may take the quiz by visiting this book online.

results matching ""

    No results matching ""