Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVASCRIPT: Match each of the following terms (pass-by-value, parameter, functio

ID: 3581283 • Letter: J

Question

JAVASCRIPT: Match each of the following terms (pass-by-value, parameter, function call, function, argument, return, scope, Math.random, built-in functions, code reuse, local variable, global variable) with one of the phrases below:

I get passed into a function. ... I send values back to the calling code. ... What functions are great for. ... I'm everywhere. ... Another phrase for invoking a function. ... It really means "make a copy". ... Example of a function attached to an object. ... alert and prompt are examples. ... I'm what receives arguments. ... I'm the all important keyword. ... Where I can be seen. ... I’m around when my function is. ...

Explanation / Answer

(a) I get passed into a function.    ...   arguments

   -> Arguments are passed into a function and performs some kind of operation

  
(b) I send values back to the calling code.    ...   return

   -> Function send back the values to calling code using keyword return

  
(c) What functions are great for.    ...   code reuse

   -> Re-usability is the main feature by which same function can be called any number of times rather than calling entire code

  
(d)   I'm everywhere.    ...   global variable

   -> Global variables are accessible through out the program

  
(e)   Another phrase for invoking a function.    ...   function call
  
   -> Invoking a function can also be termed as function call
  

(f)   It really means "make a copy".    ...   pass-by-value

   -> Arguments passed as pass-by-value makes a copy of values in the called function

  
(g) Example of a function attached to an object.    ...   Math.random

   -> random is a function that generates a random number of Math object

  
(h) alert and prompt are examples.    ...   built-in functions
  
   -> There are some built-in functions that are readily available for accomplishing specific task
  

(i) I'm what receives arguments.    ...   parameter

   ->   Function parameter's receives arguments from the calling code

  
(j) I'm the all important keyword.    ... function
  
   -> function is the important keyword used for defining a function code

  
(k) Where I can be seen.    ... scope
  
   -> Variable is accessible based on scope of the variable

  
(l) I’m around when my function is.    ... local variable

   -> Local variable exist with in the function body. Outside the function they are invalid.