What is the scope of a variable declared inside a function in JavaScript?
Function scope
Global scope
Local scope
Block scope
What does the Array.isArray() method return when passed an object?
Array.isArray()
false
undefined
"object"
object
true
How many times will the following loop iterate?
for (let i = 1; i <= 10; i += 2) { console.log(i); }
10
infinite
5
6
Why is JavaScript considered a 'dynamic' language?
It enables changes to a webpage's content and behavior after it has loaded.
It allows for the creation of visually appealing websites.
It is a very old programming language.
It enforces strict data types for variables.
What will be the output of the following code?
console.log(typeof null);
null
symbol
Which of these is NOT a valid way to create a custom error in JavaScript?
throw new CustomError('This is a custom error')
throw 'This is a custom error'
throw new Error('This is a custom error')
throw { message: 'This is a custom error' }
What is the difference between a function declaration and a function expression in JavaScript?
Function expressions are hoisted, while function declarations are not.
There is no difference; they are interchangeable.
Function declarations are hoisted, while function expressions are not.
Function declarations can only be anonymous.
Which of the following is NOT a popular JavaScript framework/library?
React
Angular
Java
Vue.js
What is the correct syntax to change the text content of an element with the ID 'myElement' to 'Hello World!'?
document.querySelector('#myElement').innerHTML = 'Hello World!';
document.getElementById('myElement').innerText = 'Hello World!';
document.querySelector('#myElement').textContent = 'Hello World!';
document.getElementById('myElement').textContent = 'Hello World!';
Which tool in the browser's developer tools is most commonly used for debugging JavaScript code?
Network Tab
Application Tab
Elements Panel
Console