Javascript Flashcards
What is the output of ‘typeof null’ in JavaScript?
object
True or False: JavaScript is a compiled language.
False
Fill in the blank: In JavaScript, _____ are used to define a block of code that can be executed later.
functions
What does ‘=== ‘ do in JavaScript?
It checks for both value and type equality.
What are JavaScript closures?
Functions that have access to the outer function’s scope even after the outer function has returned.
Which method is used to convert a JSON string into a JavaScript object?
JSON.parse()
What will the following code output: console.log(0.1 + 0.2 === 0.3)?
False
What is the purpose of the ‘this’ keyword in JavaScript?
It refers to the object that is currently executing the function.
True or False: JavaScript supports multiple inheritance.
False
What is a promise in JavaScript?
An object that represents the eventual completion or failure of an asynchronous operation.
Which symbol is used to create an object in JavaScript?
{}
What will be the output of the following code: console.log(typeof NaN)?
number
Fill in the blank: JavaScript is primarily used for _____ in web development.
client-side scripting
What does the ‘map’ method do in JavaScript?
It creates a new array populated with the results of calling a provided function on every element in the calling array.
What is the difference between ‘let’ and ‘var’ in JavaScript?
‘let’ has block scope, while ‘var’ has function scope.
What are template literals in JavaScript?
String literals allowing embedded expressions, enclosed by backticks (``).
What is the use of ‘async’ and ‘await’ in JavaScript?
They are used to work with asynchronous code, making it easier to read and write.
Which operator is used to destructure an array in JavaScript?
[ ]
What is the output of ‘[] + []’ in JavaScript?
True or False: Arrow functions do not have their own ‘this’ context.
True
What is the purpose of the ‘bind’ method in JavaScript?
It creates a new function that, when called, has its ‘this’ keyword set to the provided value.
What will the following code output: console.log(‘5’ - 2)?
3
What is event delegation in JavaScript?
A technique that allows you to attach a single event listener to a parent element to manage events for multiple child elements.
Fill in the blank: In JavaScript, _____ are variables that can hold multiple values.
arrays