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
let
orconst
? - 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
const
variable?
Conditionals
- What's the syntax for an
if
statement in JavaScript? - How do you add an 'else' clause to an
if
statement? - 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
switch
statement in JavaScript? - Can a
switch
statement handle multiple cases with the same code block? - How do you ensure a
switch
statement 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
for
loop in JavaScript? - What's the syntax for a
while
loop? - What's the syntax for a
do...while
loop and how does it differ from a regularwhile
loop? - 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...of
loop? - What's the difference between a
for...in
loop and afor...of
loop? - How can you determine the index of the current element in a
for...of
loop? - What happens when you modify the array during a
for...of
loop? - 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?