JavaScript Flash Cards

What is JavaScript?
Answer: JavaScript is a high-level programming language used to create interactive web applications and dynamic user interfaces.
What are the data types in JavaScript?
Answer: JavaScript has six primitive data types: string, number, boolean, null, undefined, and symbol. It also has an object data type.
What is the difference between null and undefined in JavaScript?
Answer: Null represents a deliberate non-value, while undefined represents an absence of a value.
What is a variable in JavaScript?
Answer: A variable is a container for storing data values, such as numbers, strings, or objects.
What is the difference between let and var in JavaScript?
Answer: Both let and var are used to declare variables, but let is block-scoped, while var is function-scoped.
What is a function in JavaScript?
Answer: A function is a set of statements that perform a specific task or calculate a value. Functions can be reused throughout your code.
What is an event in JavaScript?
Answer: An event is an action or occurrence that happens in the browser, such as a user clicking a button or the page finishing loading.
What is an array in JavaScript?
Answer: An array is a data structure that stores a collection of elements, such as numbers or strings, in a single variable.
What is the DOM in JavaScript?
Answer: The Document Object Model (DOM) is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content.
What is the difference between innerHTML and textContent in JavaScript?
Answer: innerHTML retrieves or sets the HTML content within an element, while textContent retrieves or sets the text content of an element, without any HTML tags.
What is a callback function in JavaScript?
Answer: A callback function is a function that is passed as an argument to another function, and is called when the first function has completed its task.
What is a closure in JavaScript?
Answer: A closure is a function that has access to variables in its outer (enclosing) scope, even after the outer function has returned.
What is the difference between synchronous and asynchronous programming in JavaScript?
Answer: Synchronous programming is when code is executed in sequence, one statement at a time. Asynchronous programming allows