Important Concepts Flashcards
What is a variable in JavaScript?
A variable is a container that holds a value. It is used to store and manipulate data in a program.
What is a function in JavaScript?
A function is a reusable block of code that is used to perform a specific task. Functions can take input and return output.
What is an object in JavaScript?
An object is a fundamental concept in JavaScript that allows you to store properties and methods in a single unit. Objects are defined using curly braces {} and can have properties and methods that can be accessed using dot notation.
What is an Array in JavaScript?
An array is a special kind of object that can hold multiple values in a single variable. The values are stored in a linear fashion and can be accessed by their index.
What is a Conditional Statement in JavaScript?
Conditional statements allow you to specify different actions to be taken depending on certain conditions. if-else and switch statement are the examples of Conditional statements.
What is a Loop in JavaScript?
A loop is a control flow statement that allows you to execute a block of code multiple times. for, for-in, for-of and while are examples of loops in javascript.
What is a constructor function in JavaScript?
A constructor function is a special kind of function that is used to create new objects. Constructor functions are invoked with the “new” keyword and are usually used to set the initial state of an object.
What are Prototypes in JavaScript?
A prototype is an object that is used as a template for creating new objects. It is a mechanism that allows objects to inherit properties and methods from another object.
What is closure in JavaScript?
A closure is a function that has access to variables in its parent scope even after the parent function has returned. Closure allows to create private variables, and to create stateful functions.
What is a Promises in JavaScript?
A promise is an object that represents the eventual completion (or failure) of an asynchronous operation and its resulting value. Promises allow you to write asynchronous code that is easier to read and debug.
What is Event Loop in JavaScript?
The event loop is a mechanism that handles the execution of code in JavaScript. It is responsible for determining when to execute callback functions, and it allows the JavaScript runtime to run multiple tasks in parallel.
What is Asynchronous JavaScript?
Asynchronous JavaScript refers to the ability of JavaScript to handle multiple tasks at the same time. It allows your code to run without getting blocked, so the web page remains responsive, and multiple tasks can be handled simultaneously.
What is hoisting in JavaScript?
Hoisting is a mechanism in JavaScript where variable and function declarations are moved to the top of the scope, regardless of where they appear in the code. This can lead to unexpected behavior if not handled properly.
What is the keyword this
in JavaScript?
The keyword this
refers to the object that the code is currently being executed in. Its value can change depending on the context in which it is used.
What is try-catch block in JavaScript?
The try-catch block is a way to handle errors that might occur in a program. It works by allowing you to place your code in a try block, and if an error occurs, it will be caught in the catch block, where you can take appropriate action.
What are Regular Expressions in JavaScript?
Regular expressions are a way to search and match patterns in strings. They are defined using the RegExp constructor and can be used to perform tasks such as validation, pattern matching, and string replacement.
What is an Immediately-Invoked Function Expression (IIFE) in JavaScript?
An IIFE, or Immediately-Invoked Function Expression, is a function that is immediately invoked after it is defined. It allows you to create a scope for variables and functions, effectively hiding them from the rest of the code.
What is a generator function in JavaScript?
A generator function is a special kind of function that can be paused and resumed. It uses the keyword yield
to indicate where the function should be paused and resumed. This allows writing asynchronous code in a more synchronous style.
What is JSON in JavaScript?
JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. JSON is a standard format for data exchange between a browser and a server.
what is AJAX in JavaScript?
AJAX (Asynchronous JavaScript and XML) is a technology that allows you to send and receive data from a server asynchronously, without reloading the entire page. It is used to build dynamic and responsive web applications.