JavaScript Questions
The following questions can be used as a guide to direct your learning. They are not mandatory
Variables
- How do you declare a variable in JavaScript?
- What's the difference between
var,let, andconst? - What are the rules for naming variables in JavaScript?
- Can you declare a variable without a value in JavaScript?
- What's the scope of a variable declared with
var? - What's the scope of a variable declared with
letorconst? - What's hoisting in JavaScript?
- What happens when you try to use a variable that hasn't been declared?
- How do you change the value of a variable in JavaScript?
- Can you change the value of a
constvariable?
Conditionals
- What's the syntax for an
ifstatement in JavaScript? - How do you add an 'else' clause to an
ifstatement? - How do you chain multiple conditions together using
else if? - What's the difference between
==and===in conditionals? - How does JavaScript handle truthy and falsy values in conditionals?
- What's the syntax for a
switchstatement in JavaScript? - Can a
switchstatement handle multiple cases with the same code block? - How do you ensure a
switchstatement doesn't fall through to the next case? - What's a ternary operator and how does it work?
- Can you use nested conditionals in JavaScript? How?
Loops
- What's the syntax for a
forloop in JavaScript? - What's the syntax for a
whileloop? - What's the syntax for a
do...whileloop and how does it differ from a regularwhileloop? - How do you break out of a loop early?
- How do you skip an iteration in a loop?
- How do you loop over an array using a
for...ofloop? - What's the difference between a
for...inloop and afor...ofloop? - How can you determine the index of the current element in a
for...ofloop? - What happens when you modify the array during a
for...ofloop? - Can you use nested loops in JavaScript? How?
Functions
- What's the syntax for declaring a function in JavaScript?
- What's the difference between a function declaration and a function expression?
- What's an arrow function and how does it differ from a regular function?
- How do you call a function in JavaScript?
- Can a function return a value? How?
- Can a function take parameters? How?
- What's the difference between parameters and arguments in a function?
- How does JavaScript handle default parameters?
- How does JavaScript handle extra arguments passed to a function?
- What's a callback function?
Array of Objects
- How do you declare an array of objects in JavaScript?
- How do you access a specific object in an array?
- How do you access a property of an object in an array?
- How do you change the value of an object's property in an array?
- How do you add a new object to an array?
- How do you remove an object from an array?
- How do you loop over an array of objects?
- How do you find an object in an array based on a property value?
- How do you sort an array of objects based on a property value?
- How do you filter an array of objects based on a property value?