Parameters
Returns
Default Returns
Variable Scope
General Knowledge
100

What is a parameter in JavaScript?

A parameter is a variable listed in the function definition and used to accept input.

100

What does the return statement do in a function?

It stops the function execution and sends a value back to the caller.

100

What is the default return value of a function without a return statement?

undefined

100

What is variable scope?

The context where a variable is accessible, such as global, function, or block scope

100

What is the Dallas Cowboy's record?

3-7

200

How do you define a function with two parameters? 

Draw on board

function example(param1, param2) { /* code */ }

200

Write a function that returns the square of a number. 


Draw on Board

function square(num){

return num * num

}

200

Why does JavaScript return undefined for some functions?

If no return statement is provided, the function returns undefined by default.

200

True or False: Generally speaking, a const can be changed.

False

200

What is the purpose of the console.log function?

To output messages to the browser’s console, often used for debugging.

300

What happens if you call a function without passing a value for a parameter?

The parameter is undefined

300

Can a function have multiple return statements? Explain.

Yes, but only one will execute depending on the code logic.

300

True or False: An Argument will never override a default variable

False

300

What would be the difference between a block and local scope?

Block is within a for or while loop while a local scope is within a function

300

What is the difference between == and == in JavaScript?

== checks for equality while = assigns value

400

What is the difference between parameters and arguments?

Parameters are placeholders in the function definition, while arguments are actual values passed to the function.

400

What happens if a return statement is followed by other lines of code?

Those lines will not execute since the function exits as soon as return is encountered.

400

What does the following code return?


function example () {

return;

"Hello!";

}

undefined. Return terminates the function before the string.

400

What is a global variable, and why is it important to limit their use?

A global variable is declared outside of any function and is accessible throughout the program. Limiting their use prevents unintended overwriting and improves modularity and maintainability.

400

Name three JavaScript data types.

String, int, double, boolean

500

How can you set a default value for a parameter?


Draw on Board

By assigning a value during the function definition, e.g., function example(param = 10) { /* code */ }.

500

What is the difference between returning a value and modifying a variable inside a function?

 function add(a, b) {   

 return a + b;  

let total = 0; 

function increment() 

{    total++; 

 }

Returning a value sends it back to the function caller, while modifying a variable inside a function changes its value locally (or globally, if the variable is in global scope).

500

What does this code do?

if (example() == undefined) 

{    

console.log("Returns undefined"); 

}

Checks to see if the function returns undefined.

500

What happens with this code?

function calculate() {    for (var i = 0; i < 5; i++) 

{       

 let sum = 0;        

sum += i;    

}    

console.log(sum);

 } 

calculate();

The error is: ReferenceError: sum is not defined.

500

What is the difference between null and undefined?

null represents an intentional absence of value, while undefined means a variable has been declared but not assigned a value.