101 Flashcards
What is JavaScript?
JavaScript is a high-level, dynamic, untyped, and interpreted programming language used primarily for web development.
True or False: JavaScript is a compiled language.
False
What does the ‘var’ keyword do in JavaScript?
The ‘var’ keyword declares a variable that is function-scoped or globally-scoped.
Fill in the blank: In JavaScript, a _______ is a collection of key-value pairs.
Object
What is the purpose of the ‘console.log()’ function?
The ‘console.log()’ function outputs messages to the web console, useful for debugging.
What is an array in JavaScript?
An array is a data structure that can hold multiple values in a single variable.
Which symbol is used to denote a single-line comment in JavaScript?
//
What is the result of 5 + ‘5’ in JavaScript?
‘55’
True or False: JavaScript is case-sensitive.
True
What does DOM stand for?
Document Object Model
What are JavaScript functions?
Functions are reusable blocks of code that perform a specific task.
What keyword is used to define a constant in JavaScript?
const
What is the difference between ‘==’ and ‘===’ in JavaScript?
’==’ checks for value equality with type coercion, while ‘===’ checks for both value and type equality.
Fill in the blank: JavaScript uses _______ to handle asynchronous operations.
Promises
What is a closure in JavaScript?
A closure is a function that retains access to its lexical scope, even when the function is executed outside that scope.
Which method is used to convert a JSON string into a JavaScript object?
JSON.parse()
What does the ‘this’ keyword refer to in JavaScript?
‘this’ refers to the context in which a function is executed.
What is the purpose of the ‘try…catch’ statement?
The ‘try…catch’ statement is used to handle exceptions and errors gracefully.
What is a promise in JavaScript?
A promise is an object that represents the eventual completion or failure of an asynchronous operation.
True or False: JavaScript supports object-oriented programming.
True
What is event bubbling in JavaScript?
Event bubbling is a type of event propagation where the event moves from the target element up to the root of the DOM.
What does the ‘map()’ method do in JavaScript?
The ‘map()’ method creates a new array populated with the results of calling a provided function on every element in the calling array.
Fill in the blank: The _______ keyword is used to create a new object in JavaScript.
new
What is the difference between ‘let’ and ‘var’?
‘let’ is block-scoped, while ‘var’ is function-scoped.
What is a callback function?
A callback function is a function passed into another function as an argument to be executed later.
What is the purpose of the ‘filter()’ method?
The ‘filter()’ method creates a new array with all elements that pass the test implemented by the provided function.
True or False: JavaScript has a built-in type for dates.
True