Which keyword is used to declare a variable in JavaScript with block-level scope?
block
var
let
const
What is the correct syntax to add an event listener to an element?
element.addListener('click', functionName)
element.addEventListener('click', functionName)
element.on('click', functionName)
element.attachEvent('click', functionName)
Why is JavaScript considered a 'dynamic' language?
It is a very old programming language.
It allows for the creation of visually appealing websites.
It enables changes to a webpage's content and behavior after it has loaded.
It enforces strict data types for variables.
Which method removes the first element from an array and returns it?
unshift()
slice()
shift()
pop()
Is it possible to have multiple 'catch' blocks associated with a single 'try' block?
Only if the 'try' block is nested inside another 'try'
Only if you re-throw the error inside the first 'catch'
Yes, to handle different error types specifically
No, you can only have one 'catch' per 'try'
Which of the following is NOT a feature of JavaScript?
Client-side scripting language
Interpreted language
Object-oriented programming capabilities
Strongly typed language
Which loop in JavaScript is best suited for iterating through the properties of an object?
do-while
for...in
while
for
Which of these is NOT a valid way to create a custom error in JavaScript?
throw new Error('This is a custom error')
throw 'This is a custom error'
throw new CustomError('This is a custom error')
throw { message: 'This is a custom error' }
Which operator is used to check for strict equality (value and type) in JavaScript?
===
!=
==
=
Which event is commonly used for handling form submissions?
'submit'
'input'
'click'
'change'