JavaScript Top 500 Interview Questions

You can add your questions in the comment sect

Questions
What are the possible ways to create objects in JavaScript
What is prototype chain
What is the difference between Call, Apply and Bind
What is JSON and its common operations
What is the purpose of the array slice method
What is the purpose of the array splice method
What is the difference between slice and splice
How do you compare Object and Map
What is the difference between == and === operators
What are lambda or arrow functions
What is a first class function
What is a first order function
What is a higher order function
What is a unary function
What is the currying function
What is a pure function
What is the purpose of the let keyword
What is the difference between let and var
What is the reason to choose the name let as a keyword
How do you redeclare variables in switch block without an error
What is the Temporal Dead Zone
What is IIFE(Immediately Invoked Function Expression)
How do you decode or encode a URL in JavaScript?
What is memoization
What is Hoisting
What are classes in ES6
What are closures
What are modules
Why do you need modules
What is scope in javascript
What is a service worker
How do you manipulate DOM using a service worker
How do you reuse information across service worker restarts
What is IndexedDB
What is web storage
What is a post message
What is a cookie
Why do you need a Cookie
What are the options in a cookie
How do you delete a cookie
What are the differences between cookie, local storage and session storage
What is the main difference between localStorage and sessionStorage
How do you access web storage
What are the methods available on session storage
What is a storage event and its event handler
Why do you need web storage
How do you check web storage browser support
How do you check web workers browser support
Give an example of web worker
What are the restrictions of web workers on DOM
What is a promise
Why do you need a promise
What are the three states of promise
What is a callback function
Why do we need callbacks
What is a callback hell
What is server-sent events
How do you receive server-sent event notifications
How do you check browser support for server-sent events
What are the events available for server sent events
What are the main rules of promise
What is callback in callback
What is promise chaining
What is promise.all
What is the purpose of race method in promise
What is a strict mode in javascript
Why do you need strict mode
How do you declare strict mode
What is the purpose of double exclamation
What is the purpose of delete operator
What is typeof operator
What is undefined property
What is null value
What is the difference between null and undefined
What is eval
What is the difference between window and document
How do you access history in javascript
How do you detect caps lock key turned on or not
What is isNaN
What are the differences between undeclared and undefined variables
What are global variables
What are the problems with global variables
What is NaN property
What is the purpose of isFinite function
What is an event flow
What is event bubbling
What is event capturing
How do you submit a form using JavaScript
How do you find operating system details
What is the difference between document load and DOMContentLoaded events
What is the difference between native, host and user objects
What are the tools or techniques used for debugging JavaScript code
What are the pros and cons of promises over callbacks
What is the difference between an attribute and a property
What is same-origin policy
What is the purpose of void 0
Is JavaScript a compiled or interpreted language
Is JavaScript a case-sensitive language
Is there any relation between Java and JavaScript
What are events
Who created javascript
What is the use of preventDefault method
What is the use of stopPropagation method
What are the steps involved in return false
What is BOM
What is the use of setTimeout
What is the use of setInterval
Why is JavaScript treated as Single threaded
What is an event delegation
What is ECMAScript
What is JSON
What are the syntax rules of JSON
What is the purpose JSON stringify
How do you parse JSON string
Why do you need JSON
What are PWAs
What is the purpose of clearTimeout method
What is the purpose of clearInterval method
How do you redirect new page in javascript
How do you check whether a string contains a substring
How do you validate an email in javascript
How do you get the current url with javascript
What are the various url properties of location object
How do get query string values in javascript
How do you check if a key exists in an object
How do you loop through or enumerate javascript object
How do you test for an empty object
What is an arguments object
How do you make first letter of the string in an uppercase
What are the pros and cons of for loop
How do you display the current date in javascript
How do you compare two date objects
How do you check if a string starts with another string
How do you trim a string in javascript
How do you add a key value pair in javascript
Is the '!--' notation represents a special operator
How do you assign default values to variables
How do you define multiline strings
What is an app shell model
Can we define properties for functions
What is the way to find the number of parameters expected by a function
What is a polyfill
What are break and continue statements
What are js labels
What are the benefits of keeping declarations at the top
What are the benefits of initializing variables
What are the recommendations to create new object
How do you define JSON arrays
How do you generate random integers
Can you write a random integers function to print integers with in a range
What is tree shaking
What is the need of tree shaking
Is it recommended to use eval
What is a Regular Expression
What are the string methods available in Regular expression
What are modifiers in regular expression
What are regular expression patterns
What is a RegExp object
How do you search a string for a pattern
What is the purpose of exec method
How do you change style of a HTML element
What would be the result of 1+2+'3'
What is a debugger statement
What is the purpose of breakpoints in debugging
Can I use reserved words as identifiers
How do you detect a mobile browser
How do you detect a mobile browser without regexp
How do you get the image width and height using JS
How do you make synchronous HTTP request
How do you make asynchronous HTTP request
How do you convert date to another timezone in javascript
What are the properties used to get size of window
What is a conditional operator in javascript
Can you apply chaining on conditional operator
What are the ways to execute javascript after page load
What is the difference between proto and prototype
Give an example where do you really need semicolon
What is a freeze method
What is the purpose of freeze method
Why do I need to use freeze method
How do you detect a browser language preference
How to convert string to title case with javascript
How do you detect javascript disabled in the page
What are various operators supported by javascript
What is a rest parameter
What happens if you do not use rest parameter as a last argument
What are the bitwise operators available in javascript
What is a spread operator
How do you determine whether object is frozen or not
How do you determine two values same or not using object
What is the purpose of using object is method
How do you copy properties from one object to other
What are the applications of assign method
What is a proxy object
What is the purpose of seal method
What are the applications of seal method
What are the differences between freeze and seal methods
How do you determine if an object is sealed or not
How do you get enumerable key and value pairs
What is the main difference between Object.values and Object.entries method
How can you get the list of keys of any object
How do you create an object with prototype
What is a WeakSet
What are the differences between WeakSet and Set
List down the collection of methods available on WeakSet
What is a WeakMap
What are the differences between WeakMap and Map
List down the collection of methods available on WeakMap
What is the purpose of uneval
How do you encode an URL
How do you decode an URL
How do you print the contents of web page
What is the difference between uneval and eval
What is an anonymous function
What is the precedence order between local and global variables
What are javascript accessors
How do you define property on Object constructor
What is the difference between get and defineProperty
What are the advantages of Getters and Setters
Can I add getters and setters using defineProperty method
What is the purpose of switch-case
What are the conventions to be followed for the usage of swtich case
What are primitive data types
What are the different ways to access object properties
What are the function parameter rules
What is an error object
When you get a syntax error
What are the different error names from error object
What are the various statements in error handling
What are the two types of loops in javascript
What is nodejs
What is an Intl object
How do you perform language specific date and time formatting
What is an Iterator
How does synchronous iteration works
What is an event loop
What is call stack
What is an event queue
What is a decorator
What are the properties of Intl object
What is an Unary operator
How do you sort elements in an array
What is the purpose of compareFunction while sorting arrays
How do you reversing an array
How do you find min and max value in an array
How do you find min and max values without Math functions
What is an empty statement and purpose of it
How do you get meta data of a module
What is a comma operator
What is the advantage of a comma operator
What is typescript
What are the differences between javascript and typescript
What are the advantages of typescript over javascript
What is an object initializer
What is a constructor method
What happens if you write constructor more than once in a class
How do you call the constructor of a parent class
How do you get the prototype of an object
What happens If I pass string type for getPrototype method
How do you set prototype of one object to another
How do you check whether an object can be extendable or not
How do you prevent an object to extend
What are the different ways to make an object non-extensible
How do you define multiple properties on an object
What is MEAN in javascript
What Is Obfuscation in javascript
Why do you need Obfuscation
What is Minification
What are the advantages of minification
What are the differences between Obfuscation and Encryption
What are the common tools used for minification
How do you perform form validation using javascript
How do you perform form validation without javascript
What are the DOM methods available for constraint validation
What are the available constraint validation DOM properties
What are the list of validity properties
Give an example usage of rangeOverflow property
Is enums feature available in javascript
What is an enum
How do you list all properties of an object
How do you get property descriptors of an object
What are the attributes provided by a property descriptor
How do you extend classes
How do I modify the url without reloading the page
How do you check whether an array includes a particular value or not
How do you compare scalar arrays
How to get the value from get parameters
How do you print numbers with commas as thousand separators
What is the difference between java and javascript
Does javascript supports namespace
How do you declare namespace
How do you invoke javascript code in an iframe from parent page
How do get the timezone offset from date
How do you load CSS and JS files dynamically
What are the different methods to find HTML elements in DOM
What is jQuery
What is V8 JavaScript engine
Why do we call javascript as dynamic language
What is a void operator
How to set the cursor to wait
How do you create an infinite loop
Why do you need to avoid with statement
What is the output of below for loops
List down some of the features of ES6
What is ES6
Can I redeclare let and const variables
Is const variable makes the value immutable
What are default parameters
What are template literals
How do you write multi-line strings in template literals
What are nesting templates
What are tagged templates
What are raw strings
What is destructuring assignment
What are default values in destructuring assignment
How do you swap variables in destructuring assignment
What are enhanced object literals
What are dynamic imports
What are the use cases for dynamic imports
What are typed arrays
What are the advantages of module loaders
What is collation
What is for...of statement
What is the output of below spread operator array
Is PostMessage secure
What are the problems with postmessage target origin as wildcard
How do you avoid receiving postMessages from attackers
Can I avoid using postMessages completely
Is postMessages synchronous
What paradigm is Javascript
What is the difference between internal and external javascript
Is JavaScript faster than server side script
How do you get the status of a checkbox
What is the purpose of double tilde operator
How do you convert character to ASCII code
What is ArrayBuffer
What is the output of below string expression
What is the purpose of Error object
What is the purpose of EvalError object
What are the list of cases error thrown from non-strict mode to strict mode
Do all objects have prototypes
What is the difference between a parameter and an argument
What is the purpose of some method in arrays
How do you combine two or more arrays
What is the difference between Shallow and Deep copy
How do you create specific number of copies of a string
How do you return all matching strings against a regular expression
How do you trim a string at the beginning or ending
What is the output of below console statement with unary operator
Does javascript uses mixins
What is a thunk function
What are asynchronous thunks
What is the output of below function calls
How to remove all line breaks from a string
What is the difference between reflow and repaint
What happens with negating an array
What happens if we add two arrays
What is the output of prepend additive operator on falsy values
How do you create self string using special characters
How do you remove falsy values from an array
How do you get unique values of an array
What is destructuring aliases
How do you map the array values without using map method
How do you empty an array
How do you rounding numbers to certain decimals
What is the easiest way to convert an array to an object
How do you create an array with some data
What are the placeholders from console object
Is it possible to add CSS to console messages
What is the purpose of dir method of console object
Is it possible to debug HTML elements in console
How do you display data in a tabular format using console object
How do you verify that an argument is a Number or not
How do you create copy to clipboard button
What is the shortcut to get timestamp
How do you flattening multi dimensional arrays
What is the easiest multi condition checking
How do you capture browser back button
How do you disable right click in the web page
What are wrapper objects
What is AJAX
What are the different ways to deal with Asynchronous Code
How to cancel a fetch request
What is web speech API
What is minimum timeout throttling
How do you implement zero timeout in modern browsers
What are tasks in event loop
What are microtasks
What are different event loops
What is the purpose of queueMicrotask
How do you use javascript libraries in typescript file
What are the differences between promises and observables
What is heap
What is an event table
What is a microTask queue
What is the difference between shim and polyfill
How do you detect primitive or non primitive value type
What is babel
Is Node.js completely single threaded
What are the common use cases of observables
What is RxJS
What is the difference between Function constructor and function declaration
What is a Short circuit condition
What is the easiest way to resize an array
What is an observable
What is the difference between function and class declarations
What is an async function
How do you prevent promises swallowing errors
What is deno
How do you make an object iterable in javascript
What is a Proper Tail Call
How do you check an object is a promise or not
How to detect if a function is called as constructor
What are the differences between arguments object and rest parameter
What are the differences between spread operator and rest parameter
What are the different kinds of generators
What are the built-in iterables
What are the differences between for...of and for...in statements
How do you define instance and non-instance properties
What is the difference between isNaN and Number.isNaN?
How to invoke an IIFE without any extra brackets?
Is that possible to use expressions in switch cases?
What is the easiest way to ignore promise errors?
How do style the console output using CSS?
What is nullish coalescing operator(??)?
How do you group and nest console output?
What is the difference between dense and sparse arrays?
What are the different ways to create sparse arrays?
What is the difference between setTimeout, setImmediate and process.nextTick?