{"id":21316215,"url":"https://github.com/rajeevranjancom/javascript","last_synced_at":"2025-08-21T10:04:26.705Z","repository":{"id":232314626,"uuid":"295674671","full_name":"rajeevranjancom/Javascript","owner":"rajeevranjancom","description":"Javascript notes and Program from Basic","archived":false,"fork":false,"pushed_at":"2021-05-30T07:19:43.000Z","size":6049,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T10:36:45.267Z","etag":null,"topics":["javascript","javascript-es6","javascript-framework","javascript-frameworks","javascript-game","javascript-library","javascript-tools"],"latest_commit_sha":null,"homepage":"https://www.w3schools.com/js/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rajeevranjancom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-09-15T09:12:30.000Z","updated_at":"2022-01-20T22:15:43.000Z","dependencies_parsed_at":"2024-04-09T04:34:07.766Z","dependency_job_id":null,"html_url":"https://github.com/rajeevranjancom/Javascript","commit_stats":null,"previous_names":["rajeevranjancom/javascript"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajeevranjancom%2FJavascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajeevranjancom%2FJavascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajeevranjancom%2FJavascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajeevranjancom%2FJavascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rajeevranjancom","download_url":"https://codeload.github.com/rajeevranjancom/Javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243795972,"owners_count":20349250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","javascript-es6","javascript-framework","javascript-frameworks","javascript-game","javascript-library","javascript-tools"],"created_at":"2024-11-21T18:31:12.080Z","updated_at":"2025-03-15T21:40:24.487Z","avatar_url":"https://github.com/rajeevranjancom.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript Interview Questions \u0026 Answers\n\n## Disclaimer\n\nThe questions provided in this repository are the summary of frequently asked questions across numerous companies. We cannot guarantee that these questions will actually be asked during your interview process, nor should you focus on memorizing all of them. The primary purpose is for you to get a sense of what some companies might ask — do not get discouraged if you don't know the answer to all of them ⁠— that is ok!\n\nGood luck with your interview 😊\n\n---\n\n### Table of Contents\n\n| No. | Questions |\n|---- | ---------\n|1  | [What are the possible ways to create objects in JavaScript](#what-are-the-possible-ways-to-create-objects-in-javascript) |\n|2  | [What is prototype chain](#what-is-a-prototype-chain)|\n|3  | [What is the difference between Call, Apply and Bind](#what-is-the-difference-between-call-apply-and-bind)|\n|4  | [What is JSON and its common operations](#what-is-json-and-its-common-operations)|\n|5  | [What is the purpose of the array slice method](#what-is-the-purpose-of-the-array-slice-method)|\n|6  | [What is the purpose of the array splice method](#what-is-the-purpose-of-the-array-splice-method)|\n|7  | [What is the difference between slice and splice](#what-is-the-difference-between-slice-and-splice)|\n|8  | [How do you compare Object and Map](#how-do-you-compare-object-and-map)|\n|9  | [What is the difference between == and === operators](#what-is-the-difference-between-==-and-===-operators)|\n|10 | [What are lambda or arrow functions](#what-are-lambda-or-arrow-functions)|\n|11 | [What is a first class function](#what-is-a-first-class-function)|\n|12 | [What is a first order function](#what-is-a-first-order-function)|\n|13 | [What is a higher order function](#what-is-a-higher-order-function)|\n|14 | [What is a unary function](#what-is-a-unary-function)|\n|15 | [What is the currying function](#what-is-the-currying-function)|\n|16 | [What is a pure function](#what-is-a-pure-function)|\n|17 | [What is the purpose of the let keyword](#what-is-the-purpose-of-the-let-keyword)|\n|18 | [What is the difference between let and var](#what-is-the-difference-between-let-and-var)|\n|19 | [What is the reason to choose the name let as a keyword](#what-is-the-reason-to-choose-the-name-let-as-a-keyword)|\n|20 | [How do you redeclare variables in switch block without an error](#how-do-you-redeclare-variables-in-switch-block-without-an-error)|\n|21 | [What is the Temporal Dead Zone](#what-is-the-temporal-dead-zone)|\n|22 | [What is IIFE(Immediately Invoked Function Expression)](#what-is-iifeimmediately-invoked-function-expression)|\n|23 | [What is the benefit of using modules](#what-is-the-benefit-of-using-modules)|\n|24 | [What is memoization](#what-is-memoization)|\n|25 | [What is Hoisting](#what-is-hoisting)|\n|26 | [What are classes in ES6](#what-are-classes-in-es6)|\n|27 | [What are closures](#what-are-closures)|\n|28 | [What are modules](#what-are-modules)|\n|29 | [Why do you need modules](#why-do-you-need-modules)|\n|30 | [What is scope in javascript](#what-is-scope-in-javascript)|\n|31 | [What is a service worker](#what-is-a-service-worker)|\n|32 | [How do you manipulate DOM using a service worker](#how-do-you-manipulate-dom-using-a-service-worker)|\n|33 | [How do you reuse information across service worker restarts](#how-do-you-reuse-information-across-service-worker-restarts)|\n|34 | [What is IndexedDB](#what-is-indexeddb)|\n|35 | [What is web storage](#what-is-web-storage)|\n|36 | [What is a post message](#what-is-a-post-message)|\n|37 | [What is a cookie](#what-is-a-cookie)|\n|38 | [Why do you need a Cookie](#why-do-you-need-a-cookie)|\n|39 | [What are the options in a cookie](#what-are-the-options-in-a-cookie)|\n|40 | [How do you delete a cookie](#how-do-you-delete-a-cookie)|\n|41 | [What are the differences between cookie, local storage and session storage](#What-are-the-differences-between-cookie-local-storage-and-session-storage)|\n|42 | [What is the main difference between localStorage and sessionStorage](#what-is-the-main-difference-between-localstorage-and-sessionstorage)|\n|43 | [How do you access web storage](#how-do-you-access-web-storage)|\n|44 | [What are the methods available on session storage](#what-are-the-methods-available-on-session-storage)|\n|45 | [What is a storage event and its event handler](#what-is-a-storage-event-and-its-event-handler)|\n|46 | [Why do you need web storage](#why-do-you-need-web-storage)|\n|47 | [How do you check web storage browser support](#how-do-you-check-web-storage-browser-support)|\n|48 | [How do you check web workers browser support](#how-do-you-check-web-workers-browser-support)|\n|49 | [Give an example of web worker](#give-an-example-of-web-worker)|\n|50 | [What are the restrictions of web workers on DOM](#what-are-the-restrictions-of-web-workers-on-dom)|\n|51 | [What is a promise](#what-is-a-promise)|\n|52 | [Why do you need a promise](#why-do-you-need-a-promise)|\n|53 | [What are the three states of promise](#what-are-the-three-states-of-promise)|\n|54 | [What is a callback function](#what-is-a-callback-function)|\n|55 | [Why do we need callbacks](#why-do-we-need-callbacks)|\n|56 | [What is a callback hell](#what-is-a-callback-hell)|\n|57 | [What is server-sent events](#what-is-server-sent-events)|\n|58 | [How do you receive server-sent event notifications](#how-do-you-receive-server-sent-event-notifications)|\n|59 | [How do you check browser support for server-sent events](#how-do-you-check-browser-support-for-server-sent-events)|\n|60 | [What are the events available for server sent events](#what-are-the-events-available-for-server-sent-events)|\n|61 | [What are the main rules of promise](#what-are-the-main-rules-of-promise)|\n|62 | [What is callback in callback](#what-is-callback-in-callback)|\n|63 | [What is promise chaining](#what-is-promise-chaining)|\n|64 | [What is promise.all](#what-is-promise.all)|\n|65 | [What is the purpose of race method in promise](#what-is-the-purpose-of-race-method-in-promise)|\n|66 | [What is a strict mode in javascript](#what-is-a-strict-mode-in-javascript)|\n|67 | [Why do you need strict mode](#why-do-you-need-strict-mode)|\n|68 | [How do you declare strict mode](#how-do-you-declare-strict-mode)|\n|69 | [What is the purpose of double exclamation](#what-is-the-purpose-of-double-exclamation)|\n|70 | [What is the purpose of delete operator](#what-is-the-purpose-of-delete-operator)|\n|71 | [What is typeof operator](#what-is-typeof-operator)|\n|72 | [What is undefined property](#what-is-undefined-property)|\n|73 | [What is null value](#what-is-null-value)|\n|74 | [What is the difference between null and undefined](#what-is-the-difference-between-null-and-undefined)|\n|75 | [What is eval](#What-is-eval)|\n|76 | [What is the difference between window and document](#what-is-the-difference-between-window-and-document)|\n|77 | [How do you access history in javascript](#how-do-you-access-history-in-javascript)|\n|78 | [What are the javascript data types](#what-are-the-javascript-data-types)|\n|79 | [What is isNaN](#what-is-isnan)|\n|80 | [What are the differences between undeclared and undefined variables](#what-are-the-differences-between-undeclared-and-undefined-variables)|\n|81 | [What are global variables](#what-are-global-variables)|\n|82 | [What are the problems with global variables](#what-are-the-problems-with-global-variables)|\n|83 | [What is NaN property](#what-is-nan-property)|\n|84 | [What is the purpose of isFinite function](#what-is-the-purpose-of-isfinite-function)\n|85 | [What is an event flow](#what-is-an-event-flow)|\n|86 | [What is event bubbling](#what-is-event-bubbling)|\n|87 | [What is event capturing](#what-is-event-capturing)|\n|88 | [How do you submit a form using JavaScript](#how-do-you-submit-a-form-using-javascript)|\n|89 | [How do you find operating system details](#how-do-you-find-operating-system-details)|\n|90 | [What is the difference between document load and DOMContentLoaded events](#what-is-the-difference-between-document-load-and-domcontentloaded-events)|\n|91 | [What is the difference between native, host and user objects](#what-is-the-difference-between-native,-host-and-user-objects)|\n|92 | [What are the tools or techniques used for debugging JavaScript code](#what-are-the-tools-or-techniques-used-for-debugging-javascript-code)|\n|93 | [What are the pros and cons of promises over callbacks](#what-are-the-pros-and-cons-of-promises-over-callbacks)|\n|94 | [What is the difference between an attribute and a property](#what-is-the-difference-between-an-attribute-and-a-property)|\n|95 | [What is same-origin policy](#what-is-same-origin-policy)|\n|96 | [What is the purpose of void 0](#what-is-the-purpose-of-void-0)|\n|97 | [Is JavaScript a compiled or interpreted language](#is-javascript-a-compiled-or-interpreted-language)|\n|98 | [Is JavaScript a case-sensitive language](#is-javascript-a-case-sensitive-language)|\n|99 | [Is there any relation between Java and JavaScript](#is-there-any-relation-between-java-and-javascript)|\n|100| [What are events](#what-are-events)|\n|101| [Who created javascript](#who-created-javascript)|\n|102| [What is the use of preventDefault method](#what-is-the-use-of-preventdefault-method)|\n|103| [What is the use of stopPropagation method](#what-is-the-use-of-stoppropagation-method)|\n|104| [What are the steps involved in return false](#what-are-the-steps-involved-in-return-false)|\n|105| [What is BOM](#what-is-bom)|\n|106| [What is the use of setTimeout](#what-is-the-use-of-settimeout)|\n|107| [What is the use of setInterval](#what-is-the-use-of-setinterval)|\n|108| [Why is JavaScript treated as Single threaded](#why-is-javascript-treated-as-single-threaded)|\n|109| [What is an event delegation](#what-is-an-event-delegation)|\n|110| [What is ECMAScript](#what-is-ecmascript)|\n|111| [What is JSON](#what-is-json)|\n|112| [What are the syntax rules of JSON](#what-are-the-syntax-rules-of-json)|\n|113| [What is the purpose JSON stringify](#what-is-the-purpose-json-stringify)|\n|114| [How do you parse JSON string](#how-do-you-parse-json-string)|\n|115| [Why do you need JSON](#why-do-you-need-json)|\n|116| [What are PWAs](#what-are-pwas?)|\n|117| [What is the purpose of clearTimeout method](#what-is-the-purpose-of-cleartimeout-method)|\n|118| [What is the purpose of clearInterval method](#what-is-the-purpose-of-clearinterval-method)|\n|119| [How do you redirect new page in javascript](#how-do-you-redirect-new-page-in-javascript)|\n|120| [How do you check whether a string contains a substring](#how-do-you-check-whether-a-string-contains-a-substring)|\n|121| [How do you validate an email in javascript](#how-do-you-validate-an-email-in-javascript)|\n|122| [How do you get the current url with javascript](#how-do-you-get-the-current-url-with-javascript)|\n|123| [What are the various url properties of location object](#what-are-the-various-url-properties-of-location-object)|\n|124| [How do get query string values in javascript](#how-do-get-query-string-values-in-javascript)|\n|125| [How do you check if a key exists in an object](#how-do-you-check-if-a-key-exists-in-an-object)|\n|126| [How do you loop through or enumerate javascript object](#how-do-you-loop-through-or-enumerate-javascript-object)|\n|127| [How do you test for an empty object](#how-do-you-test-for-an-empty-object)|\n|128| [What is an arguments object](#what-is-an-arguments-object)|\n|129| [How do you make first letter of the string in an uppercase](#how-do-you-make-first-letter-of-the-string-in-an-uppercase)|\n|130| [What are the pros and cons of for loop](#what-are-the-pros-and-cons-of-for-loop)|\n|131| [How do you display the current date in javascript](#how-do-you-display-the-current-date-in-javascript)|\n|132| [How do you compare two date objects](#how-do-you-compare-two-date-objects)|\n|133| [How do you check if a string starts with another string](#how-do-you-check-if-a-string-starts-with-another-string)|\n|134| [How do you trim a string in javascript](#how-do-you-trim-a-string-in-javascript)|\n|135| [How do you add a key value pair in javascript](#how-do-you-add-a-key-value-pair-in-javascript)|\n|136| [Is the '!--' notation represents a special operator](#is-the-'!--'-notation-represents-a-special-operator)|\n|137| [How do you assign default values to variables](#how-do-you-assign-default-values-to-variables)|\n|138| [How do you define multiline strings](#how-do-you-define-multiline-strings)|\n|139| [What is an app shell model](#what-is-an-app-shell-model)|\n|140| [Can we define properties for functions](#can-we-define-properties-for-functions)|\n|141| [What is the way to find the number of parameters expected by a function](#what-is-the-way-to-find-the-number-of-parameters-expected-by-a-function)|\n|142| [What is a polyfill](#what-is-a-polyfill)|\n|143| [What are break and continue statements](#what-are-break-and-continue-statements)|\n|144| [What are js labels](#what-are-js-labels)|\n|145| [What are the benefits of keeping declarations at the top](#what-are-the-benefits-of-keeping-declarations-at-the-top)|\n|146| [What are the benefits of initializing variables](#what-are-the-benefits-of-initializing-variables)|\n|147| [What are the recommendations to create new object](#what-are-the-recommendations-to-create-new-object)|\n|148| [How do you define JSON arrays](#how-do-you-define-json-arrays)|\n|149| [How do you generate random integers](#how-do-you-generate-random-integers)|\n|150| [Can you write a random integers function to print integers with in a range](#can-you-write-a-random-integers-function-to-print-integers-with-in-a-range)|\n|151| [What is tree shaking](#what-is-tree-shaking)|\n|152| [What is the need of tree shaking](#what-is-the-need-of-tree-shaking)|\n|153| [Is it recommended to use eval](#is-it-recommended-to-use-eval)|\n|154| [What is a Regular Expression](#what-is-a-regular-expression)|\n|155| [What are the string methods available in Regular expression](#what-are-the-string-methods-available-in-regular-expression)|\n|156| [What are modifiers in regular expression](#what-are-modifiers-in-regular-expression)|\n|157| [What are regular expression patterns](#what-are-regular-expression-patterns)|\n|158| [What is a RegExp object](#what-is-a-regexp-object)|\n|159| [How do you search a string for a pattern](#how-do-you-search-a-string-for-a-pattern)|\n|160| [What is the purpose of exec method](#what-is-the-purpose-of-exec-method)|\n|161| [How do you change style of a HTML element](#how-do-you-change-style-of-a-html-element)|\n|162| [What would be the result of 1+2+'3'](#what-would-be-the-result-of-1+2+'3')|\n|163| [What is a debugger statement](#what-is-a-debugger-statement)|\n|164| [What is the purpose of breakpoints in debugging](#what-is-the-purpose-of-breakpoints-indebugging)|\n|165| [Can I use reserved words as identifiers](#can-i-use-reserved-words-as-identifiers)|\n|166| [How do you detect a mobile browser](#how-do-you-detect-a-mobile-browser)|\n|167| [How do you detect a mobile browser without regexp](#how-do-you-detect-a-mobile-browser-without-regexp)|\n|168| [How do you get the image width and height using JS](#how-do-you-get-the-image-width-and-height-using-js)|\n|169| [How do you make synchronous HTTP request](#how-do-you-make-synchronous-http-request)|\n|170| [How do you make asynchronous HTTP request](#how-do-you-make-asynchronous-http-request)|\n|171| [How do you convert date to another timezone in javascript](#how-do-you-convert-date-to-another-timezone-in-javascript)|\n|172| [What are the properties used to get size of window](#what-are-the-properties-used-to-get-size-of-window)|\n|173| [What is a conditional operator in javascript](#what-is-a-conditional-operator-in-javascript)|\n|174| [Can you apply chaining on conditional operator](#Can-you-apply-chaining-on-conditional-operator)|\n|175| [What are the ways to execute javascript after page load](#what-are-the-ways-to-execute-javascript-after-page-load)|\n|176| [What is the difference between proto and prototype](#what-is-the-difference-between-proto-and-prototype)|\n|177| [Give an example where do you really need semicolon](#give-an-example-where-do-you-really-need-semicolon)|\n|178| [What is a freeze method](#what-is-a-freeze-method)|\n|179| [What is the purpose of freeze method](#what-is-the-purpose-of-freeze-method)|\n|180| [Why do I need to use freeze method](#why-do-i-need-to-use-freeze-method)|\n|181| [How do you detect a browser language preference](#how-do-you-detect-a-browser-language-preference)|\n|182| [How to convert string to title case with javascript](#how-to-convert-string-to-title-case-with-javascript)|\n|183| [How do you detect javascript disabled in the page](#how-do-you-detect-javascript-disabled-in-the-page)|\n|184| [What are various operators supported by javascript](#what-are-various-operators-supported-by-javascript)|\n|185| [What is a rest parameter](#what-is-a-rest-parameter)|\n|186| [What happens if you do not use rest parameter as a last argument](#what-happens-if-you-do-not-use-rest-parameter-as-a-last-argument)|\n|187| [What are the bitwise operators available in javascript](#what-are-the-bitwise-operators-available-in-javascript)|\n|188| [What is a spread operator](#what-is-a-spread-operator)|\n|189| [How do you determine whether object is frozen or not](#how-do-you-determine-whether-object-is-frozen-or-not)|\n|190| [How do you determine two values same or not using object](#how-do-you-determine-two-values-same-or-not-using-object)|\n|191| [What is the purpose of using object is method](#what-is-the-purpose-of-using-object-is-method)|\n|192| [How do you copy properties from one object to other](#how-do-you-copy-properties-from-one-object-to-other)|\n|193| [What are the applications of assign method](#what-are-the-applications-of-assign-method)|\n|194| [What is a proxy object](#what-is-a-proxy-object)|\n|195| [What is the purpose of seal method](#what-is-the-purpose-of-seal-method)|\n|196| [What are the applications of seal method](#what-are-the-applications-of-seal-method)|\n|197| [What are the differences between freeze and seal methods](#what-are-the-differences-between-freeze-and-seal-methods)|\n|198| [How do you determine if an object is sealed or not](#how-do-you-determine-if-an-object-is-sealed-or-not)|\n|199| [How do you get enumerable key and value pairs](#how-do-you-get-enumerable-key-and-value-pairs)|\n|200| [What is the main difference between Object.values and Object.entries method](#what-is-the-main-difference-between-object.values-and-object.entries-method)|\n|201| [How can you get the list of keys of any object](#how-can-you-get-the-list-of-keys-of-any-object)|\n|202| [How do you create an object with prototype](#how-do-you-create-an-object-with-prototype)|\n|203| [What is a WeakSet](#what-is-a-weakset)|\n|204| [What are the differences between WeakSet and Set](#what-are-the-differences-between-weakset-and-set)|\n|205| [List down the collection of methods available on WeakSet](#list-down-the-collection-of-methods-available-on-weakset)|\n|206| [What is a WeakMap](#what-is-a-weakmap)|\n|207| [What are the differences between WeakMap and Map](#what-are-the-differences-between-weakmap-and-map)|\n|208| [List down the collection of methods available on WeakMap](#list-down-the-collection-of-methods-available-on-weakmap)|\n|209| [What is the purpose of uneval](#what-is-the-purpose-of-uneval)|\n|210| [How do you encode an URL](#how-do-you-encode-an-url)|\n|211| [How do you decode an URL](#how-do-you-decode-an-url)|\n|212| [How do you print the contents of web page](#how-do-you-print-the-contents-of-web-page)|\n|213| [What is the difference between uneval and eval](#what-is-the-difference-between-uneval-and-eval)|\n|214| [What is an anonymous function](#what-is-an-anonymous-function)|\n|215| [What is the precedence order between local and global variables](#what-is-the-precedence-order-between-local-and-global-variables)|\n|216| [What are javascript accessors](#what-are-javascript-accessors)|\n|217| [How do you define property on Object constructor](#how-do-you-define-property-on-object-constructor)|\n|218| [What is the difference between get and defineProperty](#what-is-the-difference-between-get-and-defineproperty)|\n|219| [What are the advantages of Getters and Setters](#what-are-the-advantages-of-getters-and-setters)|\n|220| [Can I add getters and setters using defineProperty method](#can-i-add-getters-and-setters-using-defineproperty-method)|\n|221| [What is the purpose of switch-case](#what-is-the-purpose-of-switch-case)|\n|222| [What are the conventions to be followed for the usage of swtich case](#what-are-the-conventions-to-be-followed-for-the-usage-of-swtich-case)|\n|223| [What are primitive data types](#what-are-primitive-data-types)|\n|224| [What are the different ways to access object properties](#what-are-the-different-ways-to-access-object-properties)|\n|225| [What are the function parameter rules](#what-are-the-function-parameter-rules)|\n|226| [What is an error object](#what-is-an-error-object)|\n|227| [When you get a syntax error](#when-you-get-a-syntax-error)|\n|228| [What are the different error names from error object](#what-are-the-different-error-names-from-error-object)|\n|229| [What are the various statements in error handling](#what-are-the-various-statements-in-error-handling)|\n|230| [What are the two types of loops in javascript](#what-are-the-two-types-of-loops-in-javascript)|\n|231| [What is nodejs](#what-is-nodejs)|\n|232| [What is an Intl object](#what-is-an-intl-object)|\n|233| [How do you perform language specific date and time formatting](#how-do-you-perform-language-specific-date-and-time-formatting)|\n|234| [What is an Iterator](#what-is-an-iterator)|\n|235| [How does synchronous iteration works](#how-does-synchronous-iteration-works)|\n|236| [What is an event loop](#what-is-an-event-loop)|\n|237| [What is call stack](#what-is-call-stack)|\n|238| [What is an event queue](#what-is-an-event-queue)|\n|239| [What is a decorator](#what-is-a-decorator)|\n|240| [What are the properties of Intl object](#what-are-the-properties-of-intl-object)|\n|241| [What is an Unary operator](#what-is-an-unary-operator)|\n|242| [How do you sort elements in an array](#how-do-you-sort-elements-in-an-array)|\n|243| [What is the purpose of compareFunction while sorting arrays](#what-is-the-purpose-of-comparefunction-while-sorting-arrays)|\n|244| [How do you reversing an array](#how-do-you-reversing-an-array)|\n|245| [How do you find min and max value in an array](#how-do-you-find-min-and-max-value-in-an-array)|\n|246| [How do you find min and max values without Math functions](#how-do-you-find-min-and-max-values-without--math-functions)|\n|247| [What is an empty statement and purpose of it](#what-is-an-empty-statement-and-purpose-of-it)|\n|248| [How do you get meta data of a module](#how-do-you-get-meta-data-of-a-module)|\n|249| [What is a comma operator](#what-is-a-comma-operator)|\n|250| [What is the advantage of a comma operator](#what-is-the-advantage-of-a-comma-operator)|\n|251| [What is typescript](#what-is-typescript)|\n|252| [What are the differences between javascript and typescript](#what-are-the-differences-between-javascript-and-typescript)|\n|253| [What are the advantages of typescript over javascript](#what-are-the-advantages-of-typescript-over-javascript)|\n|254| [What is an object initializer](#what-is-an-object-initializer)|\n|255| [What is a constructor method](#what-is-a-constructor-method)|\n|256| [What happens if you write constructor more than once in a class](#what-happens-if-you-write-constructor-more-than-once-in-a-class)|\n|257| [How do you call the constructor of a parent class](#how-do-you-call-the-constructor-of-a-parent-class)|\n|258| [How do you get the prototype of an object](#how-do-you-get-the-prototype-of-an-object)|\n|259| [What happens If I pass string type for getPrototype method](#what-happens-if-i-pass-string-type-for-getprototype-method)|\n|260| [How do you set prototype of one object to another](#how-do-you-set-prototype-of-one-object-to-another)|\n|261| [How do you check whether an object can be extendable or not](#how-do-you-check-whether-an-object-can-be-extendable-or-not)|\n|262| [How do you prevent an object to extend](#how-do-you-prevent-an-object-to-extend)|\n|263| [What are the different ways to make an object non-extensible](#what-are-the-different-ways-to-make-an-object-non-extensible)|\n|264| [How do you define multiple properties on an object](#how-do-you-define-multiple-properties-on-an-object)|\n|265| [What is MEAN in javascript](#what-is-mean-in-javascript)|\n|266| [What Is Obfuscation in javascript](#what-is-obfuscation-in-javascript)|\n|267| [Why do you need Obfuscation](#why-do-you-need-obfuscation)|\n|268| [What is Minification](#what-is-minification)|\n|269| [What are the advantages of minification](#what-are-the-advantages-of-minification)|\n|270| [What are the differences between Obfuscation and Encryption](#what-are-the-differences-between-obfuscation-and-encryption)|\n|271| [What are the common tools used for minification](#what-are-the-common-tools-used-for-minification)|\n|272| [How do you perform form validation using javascript](#how-do-you-perform-form-validation-using-javascript)|\n|273| [How do you perform form validation without javascript](#how-do-you-perform-form-validation-without-javascript)|\n|274| [What are the DOM methods available for constraint validation](#what-are-the-dom-methods-available-for-constraint-validation)|\n|275| [What are the available constraint validation DOM properties](#what-are-the-available-constraint-validation-dom-properties)|\n|276| [What are the list of validity properties](#what-are-the-list-of-validity-properties)|\n|277| [Give an example usage of rangeOverflow property](#give-an-example-usage-of-rangeoverflow-property)|\n|278| [Is enums feature available in javascript](#is-enums-feature-available-in-javascript)|\n|279| [What is an enum](#What-is-an-enum)|\n|280| [How do you list all properties of an object](#how-do-you-list-all-properties-of-an-object)|\n|281| [How do you get property descriptors of an object](#how-do-you-get-property-descriptors-of-an-object)|\n|282| [What are the attributes provided by a property descriptor](#what-are-the-attributes-provided-by-a-property-descriptor)|\n|283| [How do you extend classes](#how-do-you-extend-classes)|\n|284| [How do I modify the url without reloading the page](#how-do-i-modify-the-url-without-reloading-the-page)|\n|285| [How do you check whether an array includes a particular value or not](#how-do-you-check-whether-an-array-includes-a-particular-value-or-not)|\n|286| [How do you compare scalar arrays](#how-do-you-compare-scalar-arrays)|\n|287| [How to get the value from get parameters](#how-to-get-the-value-from-get-parameters)|\n|288| [How do you print numbers with commas as thousand separators](#how-do-you-print-numbers-with-commas-as-thousand-separators)|\n|289| [What is the difference between java and javascript](#what-is-the-difference-between-java-and-javascript)|\n|290| [Is javascript supports namespace](#is-javascript-supports-namespace)|\n|291| [How do you declare namespace](#how-do-you-declare-namespace)|\n|292| [How do you invoke javascript code in an iframe from parent page](#how-do-you-invoke-javascript-code-in-an-iframe-from-parent-page)|\n|293| [How do get the timezone offset from date](#how-do-get-the-timezone-offset-from-date)|\n|294| [How do you load CSS and JS files dynamically](#how-do-you-load-css-and-js-files-dynamically)|\n|295| [What are the different methods to find HTML elements in DOM](#what-are-the-different-methods-to-find-html-elements-in-dom)|\n|296| [What is jQuery](#what-is-jquery)|\n|297| [What is V8 JavaScript engine](#what-is-v8-javascript-engine)|\n|298| [Why do we call javascript as dynamic language](#why-do-we-call-javascript-as-dynamic-language)|\n|299| [What is a void operator](#what-is-a-void-operator)|\n|300| [How to set the cursor to wait](#how-to-set-the-cursor-to-wait)|\n|301| [How do you create an infinite loop](#how-do-you-create-an-infinite-loop)|\n|302| [Why do you need to avoid with statement](#why-do-you-need-to-avoid-with-statement)|\n|303| [What is the output of below for loops](#what-is-the-output-of-below-for-loops)|\n|304| [List down some of the features of ES6](#list-down-some-of-the-features-of-es6)|\n|305| [What is ES6](#what-is-es6)|\n|306| [Can I redeclare let and const variables](#can-I-redeclare-let-and-const-variables)|\n|307| [Is const variable makes the value immutable](#is-const-variable-makes-the-value-immutable)|\n|308| [What are default parameters](#what-are-default-parameters)|\n|309| [What are template literals](#what-are-template-literals)|\n|310| [How do you write multi-line strings in template literals](#how-do-you-write-multi-line-strings-in-template-literals)|\n|311| [What are nesting templates](#what-are-nesting-templates)|\n|312| [What are tagged templates](#what-are-tagged-templates)|\n|313| [What are raw strings](#what-are-raw-strings)|\n|314| [What is destructuring assignment](#what-is-destructuring-assignment)|\n|315| [What are default values in destructuring assignment](#what-are-default-values-in-destructuring-assignment)|\n|316| [How do you swap variables in destructuring assignment](#how-do-you-swap-variables-in-destructuring-assignment)|\n|317| [What are enhanced object literals](#what-are-enhanced-object-literals)|\n|318| [What are dynamic imports](#what-are-dynamic-imports)|\n|319| [What are the use cases for dynamic imports](#what-are-the-use-cases-for-dynamic-imports)|\n|320| [What are typed arrays](#what-are-typed-arrays)|\n|321| [What are the advantages of module loaders](#what-are-the-advantages-of-module-loaders)|\n|322| [What is collation](#what-is-collation)|\n|323| [What is for...of statement](#what-is-for...of-statement)|\n|324| [What is the output of below spread operator array](#what-is-the-output-of-below-spread-operator-array)|\n|325| [Is PostMessage secure](#is-postmessage-secure)|\n|326| [What are the problems with postmessage target origin as wildcard](#what-are-the-problems-with-postmessage-target-origin-as-wildcard)|\n|327| [How do you avoid receiving postMessages from attackers](#how-do-you-avoid-receiving-postmessages-from-attackers)|\n|328| [Can I avoid using postMessages completely](#can-i-avoid-using-postmessages-completely)|\n|329| [Is postMessages synchronous](#is-postmessages-synchronous)|\n|330| [What paradigm is Javascript](#what-paradigm-is-javascript)|\n|331| [What is the difference between internal and external javascript](#what-is-the-difference-between-internal-and-external-javascript)|\n|332| [Is JavaScript faster than server side script](#is-javascript-faster-than-server-side-script)|\n|333| [How do you get the status of a checkbox](#how-do-you-get-the-status-of-a-checkbox)|\n|334| [What is the purpose of double tilde operator](#what-is-the-purpose-of-double-tilde-operator)|\n|335| [How do you convert character to ASCII code](#how-do-you-convert-character-to-ascii-code)|\n|336| [What is ArrayBuffer](#what-is-arraybuffer)|\n|337| [What is the output of below string expression](#what-is-the-output-of-below-string-expression)|\n|338| [What is the purpose of Error object](#what-is-the-purpose-of-error-object)|\n|339| [What is the purpose of EvalError object](#what-is-the-purpose-of-evalerror-object)|\n|340| [What are the list of cases error thrown from non-strict mode to strict mode](#what-are-the-list-of-cases-error-thrown-from-non-strict-mode-to-strict-mode)|\n|341| [Is all objects have prototypes](#is-all-objects-have-prototypes)|\n|342| [What is the difference between a parameter and an argument](#what-is-the-difference-between-a-parameter-and-an-argument)|\n|343| [What is the purpose of some method in arrays](#what-is-the-purpose-of-some-method-in-arrays)|\n|344| [How do you combine two or more arrays](#how-do-you-combine-two-or-more-arrays)|\n|345| [What is the difference between Shallow and Deep copy](#what-is-the-difference-between-shallow-and-deep-copy)|\n|346| [How do you create specific number of copies of a string](#how-do-you-create-specific-number-of-copies-of-a-string)|\n|347| [How do you return all matching strings against a regular expression](#how-do-you-return-all-matching-strings-against-a-regular-expression)|\n|348| [How do you trim a string at the beginning or ending](#how-do-you-trim-a-string-at-the-beginning-or-ending)|\n|349| [What is the output of below console statement with unary operator](#what-is-the-output-of-below-console-statement-with-unary-operator)|\n|350| [Does javascript uses mixins](#does-javascript-uses-mixins)|\n|351| [What is a thunk function](#what-is-a-thunk-function)|\n|352| [What are asynchronous thunks](#what-are-asynchronous-thunks)|\n|353| [What is the output of below function calls](#what-is-the-output-of-below-function-calls)|\n|354| [How to remove all line breaks from a string](#how-to-remove-all-line-breaks-from-a-string)|\n|355| [What is the difference between reflow and repaint](#what-is-the-difference-between-reflow-and-repaint)|\n|356| [What happens with negating an array](#what-happens-with-negating-an-array)|\n|357| [What happens if we add two arrays](#what-happens-if-we-add-two-arrays)|\n|358| [What is the output of prepend additive operator on falsy values](#what-is-the-output-of-prepend-additive-operator-on-falsy-values)|\n|359| [How do you create self string using special characters](#how-do-you-create-self-string-using-special-characters)|\n|360| [How do you remove falsy values from an array](#how-do-you-remove-falsy-values-from-an-array)|\n|361| [How do you get unique values of an array](#how-do-you-get-unique-values-of-an-array)|\n|362| [What is destructuring aliases](#what-is-destructuring-aliases)|\n|363| [How do you map the array values without using map method](#how-do-you-map-the-array-values-without-using-map-method)|\n|364| [How do you empty an array](#how-do-you-empty-an-array)|\n|365| [How do you rounding numbers to certain decimals](#how-do-you-rounding-numbers-to-certain-decimals)|\n|366| [What is the easiest way to convert an array to an object](#what-is-the-easiest-way-to-convert-an-array-to-an-object)|\n|367| [How do you create an array with some data](#how-do-you-create-an-array-with-some-data)|\n|368| [What are the placeholders from console object](#what-are-the-placeholders-from-console-object)|\n|369| [Is it possible to add CSS to console messages](#is-it-possible-to-add-css-to-console-messages)|\n|370| [What is the purpose of dir method of console object](#what-is-the-purpose-of-dir-method-of-console-object)|\n|371| [Is it possible to debug HTML elements in console](#is-it-possible-to-debug-html-elements-in-console)|\n|372| [How do you display data in a tabular format using console object](#how-do-you-display-data-in-a-tabular-format-using-console-object)|\n|373| [How do you verify that an argument is a Number or not](#how-do-you-verify-that-an-argument-is-a-number-or-not)|\n|374| [How do you create copy to clipboard button](#how-do-you-create-copy-to-clipboard-button)|\n|375| [What is the shortcut to get timestamp](#what-is-the-shortcut-to-get-timestamp)|\n|376| [How do you flattening multi dimensional arrays](#how-do-you-flattening-multi-dimensional-arrays)|\n|377| [What is the easiest multi condition checking](#what-is-the-easiest-multi-condition-checking)|\n|378| [How do you capture browser back button](#how-do-you-capture-browser-back-button)|\n|379| [How do you disable right click in the web page](#how-do-you-disable-right-click-in-the-web-page)|\n|380| [What are wrapper objects](#what-are-wrapper-objects)|\n|381| [What is AJAX](#what-is-ajax)|\n|382| [What are the different ways to deal with Asynchronous Code](#what-are-the-different-ways-to-deal-with-asynchronous-code)|\n|383| [How to cancel a fetch request](#how-to-cancel-a-fetch-request)|\n|384| [What is web speech API](#what-is-web-speech-api)|\n|385| [What is minimum timeout throttling](#what-is-minimum-timeout-throttling)|\n|386| [How do you implement zero timeout in modern browsers](#how-do-you-implement-zero-timeout-in-modern-browsers)|\n|387| [What are tasks in event loop](#what-are-tasks-in-event-loop)|\n|388| [What are microtasks](#what-are-microtasks)|\n|389| [What are different event loops](#what-are-different-event-loops)|\n|390| [What is the purpose of queueMicrotask](#what-is-the-purpose-of-queuemicrotask)|\n|391| [How do you use javascript libraries in typescript file](#how-do-you-use-javascript-libraries-in-typescript-file)|\n|392| [What are the differences between promises and observables](#what-are-the-differences-between-promises-and-observables)|\n|393| [What is heap](#what-is-heap)|\n|394| [What is an event table](#what-is-an-event-table)|\n|395| [What is a microTask queue](#what-is-a-microtask-queue)|\n|396| [What is the difference between shim and polyfill](#what-is-the-difference-between-shim-and-polyfill)|\n|397| [How do you detect primitive or non primitive value type](#how-do-you-detect-primitive-or-non-primitive-value-type)|\n|398| [What is babel](#what-is-babel)|\n|399| [Is Node.js completely single threaded](#is-node.js-completely-single-threaded)|\n|400| [What are the common use cases of observables](#what-are-the-common-use-cases-of-observables)|\n|401| [What is RxJS](#what-is-rxjs)|\n|402| [What is the difference between Function constructor and function declaration](#what-is-the-difference-between-function-constructor-and-function-declaration)|\n|403| [What is a Short circuit condition](#what-is-a-short-circuit-condition)|\n|404| [What is the easiest way to resize an array](#what-is-the-easiest-way-to-resize-an-array)|\n|405| [What is an observable](#what-is-an-observable)|\n|406| [What is the difference between function and class declarations](#what-is-the-difference-between-function-and-class-declarations)|\n|407| [What is an async function](#what-is-an-async-function)|\n|408| [How do you prevent promises swallowing errors](#how-do-you-prevent-promises-swallowing-errors)|\n|409| [What is deno](#what-is-deno)|\n|410| [How do you make an object iterable in javascript](#how-do-you-make-an-object-iterable-in-javascript)|\n|411| [What is a Proper Tail Call](#what-is-a-proper-tail-call)|\n|412| [How do you check an object is a promise or not](#how-do-you-check-an-object-is-a-promise-or-not)|\n|413| [How to detect if a function is called as constructor](#how-to-detect-if-a-function-is-called-as-constructor)|\n|414| [What are the differences between arguments object and rest parameter](#what-are-the-differences-between-arguments-object-and-rest-parameter)|\n|415| [What are the differences between spread operator and rest parameter](#what-are-the-differences-between-spread-operator-and-rest-parameter)|\n|416| [What are the different kinds of generators](#what-are-the-different-kinds-of-generators)|\n|417| [What are the built-in iterables](#what-are-the-built-in-iterables)|\n|418| [What are the differences between for...of and for...in statements](#what-are-the-differences-between-for...of-and-for...in-statements)|\n|419| [How do you define instance and non-instance properties](#how-do-you-define-instance-and-non-instance-properties)|\n|420| [What is the difference between isNaN and Number.isNaN?](#what-is-the-difference-between-isnan-and-number.isnan)|\n|421| [How to invoke an IIFE without any extra brackets?](#how-to-invoke-an-iife-without-any-extra-brackets)|\n|422| [Is that possible to use expressions in switch cases?](#is-that-possible-to-use-expressions-in-switch-cases)|\n|423| [What is the easiest way to ignore promise errors?](#what-is-the-easiest-way-to-ignore-promise-errors)|\n|424| [How do style the console output using CSS?](#how-do-style-the-console-output-using-css)|\n\n1. ### What are the possible ways to create objects in JavaScript\n\n   There are many ways to create objects in javascript as below\n\n   1. **Object constructor:**\n\n      The simplest way to create an empty object is using the Object constructor. Currently this approach is not recommended.\n\n      ```javascript\n      var object = new Object();\n      ```\n\n   2. **Object's create method:**\n\n      The create method of Object creates a new object by passing the prototype object as a parameter\n\n      ```javascript\n      var object = Object.create(null);\n      ```\n\n   3. **Object literal syntax:**\n\n      The object literal syntax is equivalent to create method when it passes null as parameter\n\n      ```javascript\n      var object = {};\n      ```\n\n   4. **Function constructor:**\n\n      Create any function and apply the new operator to create object instances,\n\n      ```javascript\n      function Person(name){\n         var object = {};\n         object.name=name;\n         object.age=21;\n         return object;\n      }\n      var object = new Person(\"Sudheer\");\n      ```\n\n   5. **Function constructor with prototype:**\n\n      This is similar to function constructor but it uses prototype for their properties and methods,\n\n      ```javascript\n      function Person(){}\n      Person.prototype.name = \"Sudheer\";\n      var object = new Person();\n      ```\n\n      This is equivalent to an instance created with an object create method with a function prototype and then call that function with an instance and parameters as arguments.\n\n      ```javascript\n      function func {};\n\n      new func(x, y, z);\n      ```\n\n      **(OR)**\n\n      ```javascript\n      // Create a new instance using function prototype.\n      var newInstance = Object.create(func.prototype)\n\n      // Call the function\n      var result = func.call(newInstance, x, y, z),\n\n      // If the result is a non-null object then use it otherwise just use the new instance.\n      console.log(result \u0026\u0026 typeof result === 'object' ? result : newInstance);\n      ```\n\n   6. **ES6 Class syntax:**\n\n      ES6 introduces class feature to create the objects\n\n      ```javascript\n      class Person {\n         constructor(name) {\n            this.name = name;\n         }\n      }\n\n      var object = new Person(\"Sudheer\");\n      ```\n\n   7. **Singleton pattern:**\n\n      A Singleton is an object which can only be instantiated one time. Repeated calls to its constructor return the same instance and this way one can ensure that they don't accidentally create multiple instances.\n\n      ```javascript\n      var object = new function(){\n         this.name = \"Sudheer\";\n      }\n      ```\n\n      **[⬆ Back to Top](#table-of-contents)**\n\n2. ### What is a prototype chain\n\n    **Prototype chaining** is used to build new types of objects based on existing ones. It is similar to inheritance in a class based language. \n    \n    The prototype on object instance is available through **Object.getPrototypeOf(object)** or **__proto__** property whereas prototype on constructors function is available through **Object.prototype**.\n\n    ![Screenshot](images/prototype_chain.png)\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n3. ### What is the difference between Call, Apply and Bind\n\n    The difference between Call, Apply and Bind can be explained with below examples,\n\n    **Call:** The call() method invokes a function with a given `this` value and arguments provided one by one\n\n    ```javascript\n    var employee1 = {firstName: 'John', lastName: 'Rodson'};\n    var employee2 = {firstName: 'Jimmy', lastName: 'Baily'};\n\n    function invite(greeting1, greeting2) {\n        console.log(greeting1 + ' ' + this.firstName + ' ' + this.lastName+ ', '+ greeting2);\n    }\n\n    invite.call(employee1, 'Hello', 'How are you?'); // Hello John Rodson, How are you?\n    invite.call(employee2, 'Hello', 'How are you?'); // Hello Jimmy Baily, How are you?\n    ```\n\n    **Apply:** Invokes the function with a given `this` value and allows you to pass in arguments as an array\n\n    ```javascript\n    var employee1 = {firstName: 'John', lastName: 'Rodson'};\n    var employee2 = {firstName: 'Jimmy', lastName: 'Baily'};\n\n    function invite(greeting1, greeting2) {\n        console.log(greeting1 + ' ' + this.firstName + ' ' + this.lastName+ ', '+ greeting2);\n    }\n\n    invite.apply(employee1, ['Hello', 'How are you?']); // Hello John Rodson, How are you?\n    invite.apply(employee2, ['Hello', 'How are you?']); // Hello Jimmy Baily, How are you?\n    ```\n\n    **bind:** returns a new function, allowing you to pass any number of arguments\n\n    ```javascript\n    var employee1 = {firstName: 'John', lastName: 'Rodson'};\n    var employee2 = {firstName: 'Jimmy', lastName: 'Baily'};\n\n    function invite(greeting1, greeting2) {\n        console.log(greeting1 + ' ' + this.firstName + ' ' + this.lastName+ ', '+ greeting2);\n    }\n\n    var inviteEmployee1 = invite.bind(employee1);\n    var inviteEmployee2 = invite.bind(employee2);\n    inviteEmployee1('Hello', 'How are you?'); // Hello John Rodson, How are you?\n    inviteEmployee2('Hello', 'How are you?'); // Hello Jimmy Baily, How are you?\n    ```\n\n    Call and apply are pretty interchangeable. Both execute the current function immediately. You need to decide whether it’s easier to send in an array or a comma separated list of arguments. You can remember by treating Call is for **comma** (separated list) and Apply is for **Array**. \n    \n    Whereas Bind creates a new function that will have `this` set to the first parameter passed to bind().\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n4. ### What is JSON and its common operations\n\n    **JSON** is a text-based data format following JavaScript object syntax, which was popularized by `Douglas Crockford`. It is useful when you want to transmit data across a network and it is basically just a text file with an extension of .json, and a MIME type of application/json\n    \n    **Parsing:** Converting a string to a native object\n\n    ```javascript\n    JSON.parse(text)\n    ```\n\n    **Stringification:** converting a native object to a string so it can be transmitted across the network\n\n    ```javascript\n    JSON.stringify(object)\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n5. ### What is the purpose of the array slice method\n\n    The **slice()** method returns the selected elements in an array as a new array object. It selects the elements starting at the given start argument, and ends at the given optional end argument without including the last element. If you omit the second argument then it selects till the end.\n    \n    Some of the examples of this method are,\n\n    ```javascript\n    let arrayIntegers = [1, 2, 3, 4, 5];\n    let arrayIntegers1 = arrayIntegers.slice(0,2); // returns [1,2]\n    let arrayIntegers2 = arrayIntegers.slice(2,3); // returns [3]\n    let arrayIntegers3 = arrayIntegers.slice(4); //returns [5]\n    ```\n\n    **Note:** Slice method won't mutate the original array but it returns the subset as a new array.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n6. ### What is the purpose of the array splice method\n\n    The **splice()** method is used either adds/removes items to/from an array, and then returns the removed item. The first argument specifies the array position for insertion or deletion whereas the option second argument indicates the number of elements to be deleted. Each additional argument is added to the array. \n    \n    Some of the examples of this method are,\n\n    ```javascript\n    let arrayIntegersOriginal1 = [1, 2, 3, 4, 5];\n    let arrayIntegersOriginal2 = [1, 2, 3, 4, 5];\n    let arrayIntegersOriginal3 = [1, 2, 3, 4, 5];\n\n    let arrayIntegers1 = arrayIntegersOriginal1.splice(0,2); // returns [1, 2]; original array: [3, 4, 5]\n    let arrayIntegers2 = arrayIntegersOriginal2.splice(3); // returns [4, 5]; original array: [1, 2, 3]\n    let arrayIntegers3 = arrayIntegersOriginal3.splice(3, 1, \"a\", \"b\", \"c\"); //returns [4]; original array: [1, 2, 3, \"a\", \"b\", \"c\", 5]\n    ```\n\n    **Note:** Splice method modifies the original array and returns the deleted array.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n7. ### What is the difference between slice and splice\n\n    Some of the major difference in a tabular form\n\n    | Slice | Splice |\n    |---- | ---------\n    | Doesn't modify the original array(immutable)  | Modifies the original array(mutable) |\n    | Returns the subset of original array | Returns the deleted elements as array  |\n    | Used to pick the elements from array | Used to insert or delete elements to/from array|\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n8. ### How do you compare Object and Map\n\n    **Objects** are similar to **Maps** in that both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. Due to this reason, Objects have been used as Maps historically. But there are important differences that make using a Map preferable in certain cases.\n\n    1. The keys of an Object are Strings and Symbols, whereas they can be any value for a Map, including functions, objects, and any primitive.\n    2. The keys in Map are ordered while keys added to Object are not. Thus, when iterating over it, a Map object returns keys in order of insertion.\n    3. You can get the size of a Map easily with the size property, while the number of properties in an Object must be determined manually.\n    4. A Map is an iterable and can thus be directly iterated, whereas iterating over an Object requires obtaining its keys in some fashion and iterating over them.\n    5. An Object has a prototype, so there are default keys in the map that could collide with your keys if you're not careful. As of ES5 this can be bypassed by using map = Object.create(null), but this is seldom done.\n    6. A Map may perform better in scenarios involving frequent addition and removal of key pairs.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n9. ### What is the difference between == and === operators\n\n    JavaScript provides both strict(===, !==) and type-converting(==, !=) equality comparison. The strict operators take type of variable in consideration, while non-strict operators make type correction/conversion based upon values of variables. The strict operators follow the below conditions for different types,\n    1. Two strings are strictly equal when they have the same sequence of characters, same length, and same characters in corresponding positions.\n    2. Two numbers are strictly equal when they are numerically equal. i.e, Having the same number value.\n       There are two special cases in this,\n       1. NaN is not equal to anything, including NaN.\n       2. Positive and negative zeros are equal to one another.\n    3. Two Boolean operands are strictly equal if both are true or both are false.\n    4. Two objects are strictly equal if they refer to the same Object.\n    5. Null and Undefined types are not equal with ===, but equal with ==. i.e,\n        null===undefined --\u003e false but null==undefined --\u003e true\n\n    Some of the example which covers the above cases,\n\n    ```javascript\n    0 == false   // true\n    0 === false  // false\n    1 == \"1\"     // true\n    1 === \"1\"    // false\n    null == undefined // true\n    null === undefined // false\n    '0' == false // true\n    '0' === false // false\n    []==[] or []===[] //false, refer different objects in memory\n    {}=={} or {}==={} //false, refer different objects in memory\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n10. ### What are lambda or arrow functions\n\n    An arrow function is a shorter syntax for a function expression and does not have its own **this, arguments, super, or new.target**. These functions are best suited for non-method functions, and they cannot be used as constructors.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n11. ### What is a first class function\n\n    In Javascript, functions are first class objects. First-class functions means when functions in that language are treated like any other variable.\n\n    For example, in such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a variable. For example, in the below example, handler functions assigned to a listener\n\n    ```javascript\n    const handler = () =\u003e console.log ('This is a click handler function');\n    document.addEventListener ('click', handler);\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n12. ### What is a first order function\n\n    First-order function is a function that doesn’t accept another function as an argument and doesn’t return a function as its return value.\n\n    ```javascript\n    const firstOrder = () =\u003e console.log ('I am a first order function!');\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n13. ### What is a higher order function\n\n    Higher-order function is a function that accepts another function as an argument or returns a function as a return value.\n\n    ```javascript\n    const firstOrderFunc = () =\u003e console.log ('Hello I am a First order function');\n    const higherOrder = ReturnFirstOrderFunc =\u003e ReturnFirstOrderFunc ();\n    higherOrder (firstOrderFunc);\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n14. ### What is a unary function\n\n    Unary function (i.e. monadic) is a function that accepts exactly one argument. Let us take an example of unary function. It stands for a single argument accepted by a function.\n\n    ```javascript\n    const unaryFunction = a =\u003e console.log (a + 10); // Add 10 to the given argument and display the value\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n15. ### What is the currying function\n\n    Currying is the process of taking a function with multiple arguments and turning it into a sequence of functions each with only a single argument. Currying is named after a mathematician Haskell Curry. By applying currying, a n-ary function turns it into a unary function. \n    \n    Let's take an example of n-ary function and how it turns into a currying function\n\n    ```javascript\n    const multiArgFunction = (a, b, c) =\u003e a + b + c;\n    console.log(multiArgFunction(1,2,3));// 6\n    \n    const curryUnaryFunction = a =\u003e b =\u003e c =\u003e a + b + c;\n    curryUnaryFunction (1); // returns a function: b =\u003e c =\u003e  1 + b + c\n    curryUnaryFunction (1) (2); // returns a function: c =\u003e 3 + c\n    curryUnaryFunction (1) (2) (3); // returns the number 6\n    ```\n\n    Curried functions are great to improve code reusability and functional composition.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n16. ### What is a pure function\n\n    A **Pure function** is a function where the return value is only determined by its arguments without any side effects. i.e, If you call a function with the same arguments 'n' number of times and 'n' number of places in the application then it will always return the same value.\n    \n    Let's take an example to see the difference between pure and impure functions,\n\n    ```javascript\n    //Impure\n    let numberArray = [];\n    const impureAddNumber = number =\u003e numberArray.push (number);\n    //Pure\n    const pureAddNumber = number =\u003e argNumberArray =\u003e\n      argNumberArray.concat ([number]);\n\n    //Display the results\n    console.log (impureAddNumber (6)); // returns 1\n    console.log (numberArray); // returns [6]\n    console.log (pureAddNumber (7) (numberArray)); // returns [6, 7]\n    console.log (numberArray); // returns [6]\n    ```\n\n    As per above code snippets, Push function is impure itself by altering the array and returning an push number index which is independent of parameter value. \n    \n    Whereas Concat on the other hand takes the array and concatenates it with the other array producing a whole new array without side effects. Also, the return value is a concatenation of the previous array.\n    Remember that Pure functions are important as they simplify unit testing without any side effects and no need for dependency injection. They also avoid tight coupling and make it harder to break your application by not having any side effects. These principles are coming together with **Immutability** concept of ES6 by giving preference to **const** over **let** usage.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n17. ### What is the purpose of the let keyword\n\n    The `let` statement declares a **block scope local variable**. Hence the variables defined with let keyword are limited in scope to the block, statement, or expression on which it is used. Whereas variables declared with the var keyword used to define a variable globally, or locally to an entire function regardless of block scope. Let's take an example to demonstrate the usage,\n\n    ```javascript\n    let counter = 30;\n    if (counter === 30) {\n      let counter = 31;\n      console.log(counter); // 31\n    }\n    console.log(counter); // 30 (because if block variable won't exist here)\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n18. ### What is the difference between let and var\n\n    You can list out the differences in a tabular format\n\n    | var | let |\n    |---- | ---------\n    | It is been available from the beginning of JavaScript  | Introduced as part of ES6 |\n    | It has function scope | It has block scope  |\n    | Variables will be hoisted | Hoisted but not initialized |\n\n    Let's take an example to see the difference,\n\n    ```javascript\n    function userDetails(username) {\n       if(username) {\n         console.log(salary); // undefined(due to hoisting)\n         console.log(age); // error: age is not defined\n         let age = 30;\n         var salary = 10000;\n       }\n       console.log(salary); //10000 (accessible to due function scope)\n       console.log(age); //error: age is not defined(due to block scope)\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n19. ### What is the reason to choose the name let as a keyword\n\n    Let is a mathematical statement that was adopted by early programming languages like Scheme and Basic. It has been borrowed from dozens of other languages that use let already as a traditional keyword as close to var as possible.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n20. ### How do you redeclare variables in switch block without an error\n\n    If you try to redeclare variables in a `switch block` then it will cause errors because there is only one block. For example, the below code block throws a syntax error as below,\n\n    ```javascript\n    let counter = 1;\n    switch(x) {\n      case 0:\n        let name;\n        break;\n\n      case 1:\n        let name; // SyntaxError for redeclaration.\n        break;\n    }\n    ```\n\n    To avoid this error, you can create a nested block inside a case clause and create a new block scoped lexical environment.\n\n    ```javascript\n    let counter = 1;\n        switch(x) {\n          case 0: {\n            let name;\n            break;\n          }\n          case 1: {\n            let name; // No SyntaxError for redeclaration.\n            break;\n          }\n        }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n21. ### What is the Temporal Dead Zone\n\n    The Temporal Dead Zone is a behavior in JavaScript that occurs when declaring a variable with the let and const keywords, but not with var. In ECMAScript 6, accessing a let or const variable before its declaration (within its scope) causes a ReferenceError. The time span when that happens, between the creation of a variable’s binding and its declaration, is called the temporal dead zone. Let's see this behavior with an example,\n\n    ```javascript\n    function somemethod() {\n      console.log(counter1); // undefined\n      console.log(counter2); // ReferenceError\n      var counter1 = 1;\n      let counter2 = 2;\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n22. ### What is IIFE(Immediately Invoked Function Expression)\n\n    IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined. The signature of it would be as below,\n\n    ```javascript\n    (function ()\n        {\n          // logic here\n        }\n     )\n    ();\n    ```\n\n    The primary reason to use an IIFE is to obtain data privacy because any variables declared within the IIFE cannot be accessed by the outside world. i.e, If you try to access variables with IIFE then it throws an error as below,\n\n    ```javascript\n    (function ()\n            {\n              var message = \"IIFE\";\n              console.log(message);\n            }\n     )\n    ();\n    console.log(message); //Error: message is not defined\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n23. ### What is the benefit of using modules\n\n    There are a lot of benefits to using modules in favour of a sprawling. Some of the benefits are,\n    1. Maintainability\n    2. Reusability\n    3. Namespacing\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n24. ### What is memoization\n\n    Memoization is a programming technique which attempts to increase a function’s performance by caching its previously computed results.  Each time a memoized function is called, its parameters are used to index the cache. If the data is present, then it can be returned, without executing the entire function. Otherwise the function is executed and then the result is added to the cache.\n    Let's take an example of adding function with memoization,\n\n    ```javascript\n    const memoizAddition = () =\u003e {\n      let cache = {};\n     return (value) =\u003e {\n      if (value in cache) {\n       console.log('Fetching from cache');\n       return cache[value]; // Here, cache.value cannot be used as property name starts with the number which is not a valid JavaScript  identifier. Hence, can only be accessed using the square bracket notation.\n      }\n      else {\n       console.log('Calculating result');\n       let result = value + 20;\n       cache[value] = result;\n       return result;\n      }\n     }\n    }\n    // returned function from memoizAddition\n    const addition = memoizAddition();\n    console.log(addition(20)); //output: 40 calculated\n    console.log(addition(20)); //output: 40 cached\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n25. ### What is Hoisting\n\n    Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. Remember that JavaScript only hoists declarations, not initialisation.\n    Let's take a simple example of variable hoisting,\n\n    ```javascript\n    console.log(message); //output : undefined\n    var message = 'The variable Has been hoisted';\n    ```\n\n    The above code looks like as below to the interpreter,\n\n    ```javascript\n    var message;\n    console.log(message);\n    message = 'The variable Has been hoisted';\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n26. ### What are classes in ES6\n\n    In ES6, Javascript classes are primarily syntactic sugar over JavaScript’s existing prototype-based inheritance.\n    For example, the prototype based inheritance written in function expression as below,\n\n    ```javascript\n    function Bike(model,color) {\n        this.model = model;\n        this.color = color;\n    }\n\n    Bike.prototype.getDetails = function() {\n        return this.model + ' bike has' + this.color + ' color';\n    };\n    ```\n\n    Whereas ES6 classes can be defined as an alternative\n\n    ```javascript\n    class Bike{\n      constructor(color, model) {\n        this.color= color;\n        this.model= model;\n      }\n\n      getDetails() {\n        return this.model + ' bike has' + this.color + ' color';\n      }\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n27. ### What are closures\n\n    A closure is the combination of a function and the lexical environment within which that function was declared. i.e, It is an inner function that has access to the outer or enclosing function’s variables. The closure has three scope chains\n    \n    1. Own scope where variables defined between its curly brackets\n    2. Outer function’s variables\n    3. Global variables\n    \n    Let's take an example of closure concept,\n\n    ```javascript\n    function Welcome(name){\n      var greetingInfo = function(message){\n       console.log(message+' '+name);\n      }\n    return greetingInfo;\n    }\n    var myFunction = Welcome('John');\n    myFunction('Welcome '); //Output: Welcome John\n    myFunction('Hello Mr.'); //output: Hello Mr.John\n    ```\n\n    As per the above code, the inner function(i.e, greetingInfo) has access to the variables in the outer function scope(i.e, Welcome) even after the outer function has returned.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n28. ### What are modules\n\n    Modules refer to small units of independent, reusable code and also act as the foundation of many JavaScript design patterns.  Most of the JavaScript modules export an object literal, a function, or a constructor\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n29. ### Why do you need modules\n\n    Below are the list of benefits using modules in javascript ecosystem\n    1. Maintainability\n    2. Reusability\n    3. Namespacing\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n30. ### What is scope in javascript\n\n    Scope is the accessibility of variables, functions, and objects in some particular part of your code during runtime. In other words, scope determines the visibility of variables and other resources in areas of your code.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n31. ### What is a service worker\n\n    A Service worker is basically a script (JavaScript file) that runs in the background, separate from a web page and provides features that don't need a web page or user interaction. Some of the major features of service workers are Rich offline experiences(offline first web application development), periodic background syncs, push notifications, intercept and handle network requests and programmatically managing a cache of responses.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n32. ### How do you manipulate DOM using a service worker\n\n    Service worker can't access the DOM directly. But it can communicate with the pages it controls by responding to messages sent via the `postMessage` interface, and those pages can manipulate the DOM.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n33. ### How do you reuse information across service worker restarts\n\n    The problem with service worker is that it gets terminated when not in use, and restarted when it's next needed, so you cannot rely on global state within a service worker's `onfetch` and `onmessage` handlers. In this case, service workers will have access to IndexedDB API in order to persist and reuse across restarts.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n34. ### What is IndexedDB\n\n    IndexedDB is a low-level API for client-side storage of larger amounts of structured data, including files/blobs. This API uses indexes to enable high-performance searches of this data.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n35. ### What is web storage\n\n    Web storage is an API that provides a mechanism by which browsers can store key/value pairs locally within the user's browser, in a much more intuitive fashion than using cookies. The web storage provides two mechanisms for storing data on the client.\n    1. **Local storage:** It stores data for current origin with no expiration date.\n    2. **Session storage:** It stores data for one session and the data is lost when the browser tab is closed.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n36. ### What is a post message\n\n    Post message is a method that enables cross-origin communication between Window objects.(i.e, between a page and a pop-up that it spawned, or between a page and an iframe embedded within it). Generally, scripts on different pages are allowed to access each other if and only if the pages follow same-origin policy(i.e, pages share the same protocol, port number, and host).\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n37. ### What is a Cookie\n\n    A cookie is a piece of data that is stored on your computer to be accessed by your browser. Cookies are saved as key/value pairs.\n    For example, you can create a cookie named username as below,\n\n    ```javascript\n    document.cookie = \"username=John\";\n    ```\n\n    ![Screenshot](images/cookie.png)\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n38. ### Why do you need a Cookie\n\n    Cookies are used to remember information about the user profile(such as username). It basically involves two steps,\n    1. When a user visits a web page, the user profile can be stored in a cookie.\n    2. Next time the user visits the page, the cookie remembers the user profile.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n39. ### What are the options in a cookie\n\n    There are few below options available for a cookie,\n    1. By default, the cookie is deleted when the browser is closed but you can change this behavior by setting expiry date (in UTC time).\n\n    ```javascript\n    document.cookie = \"username=John; expires=Sat, 8 Jun 2019 12:00:00 UTC\";\n    ```\n\n    1. By default, the cookie belongs to a current page. But you can tell the browser what path the cookie belongs to using a path parameter.\n\n    ```javascript\n    document.cookie = \"username=John; path=/services\";\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n40. ### How do you delete a cookie\n\n    You can delete a cookie by setting the expiry date as a passed date. You don't need to specify a cookie value in this case.\n    For example, you can delete a username cookie in the current page as below.\n\n    ```javascript\n    document.cookie = \"username=; expires=Fri, 07 Jun 2019 00:00:00 UTC; path=/;\";\n    ```\n\n    **Note:** You should define the cookie path option to ensure that you delete the right cookie. Some browsers doesn't allow to delete a cookie unless you specify a path parameter.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n41. ### What are the differences between cookie, local storage and session storage\n\n    Below are some of the differences between cookie, local storage and session storage,\n\n    | Feature | Cookie | Local storage | Session storage |\n    |---- | --------- | ----- | ----- |\n    | Accessed on client or server side | Both server-side \u0026 client-side | client-side only | client-side only |\n    | Lifetime | As configured using Expires option  | until deleted | until tab is closed |\n    | SSL support | Supported | Not supported | Not supported |\n    | Maximum data size | 4KB | 5 MB | 5MB |\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n42. ### What is the main difference between localStorage and sessionStorage\n\n    LocalStorage is the same as SessionStorage but it persists the data even when the browser is closed and reopened(i.e it has no expiration time) whereas in sessionStorage data gets cleared when the page session ends.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n43. ### How do you access web storage\n\n    The Window object implements the `WindowLocalStorage` and `WindowSessionStorage` objects which has `localStorage`(window.localStorage) and `sessionStorage`(window.sessionStorage) properties respectively. These properties create an instance of the Storage object, through which data items can be set, retrieved and removed for a specific domain and storage type (session or local).\n    For example, you can read and write on local storage objects as below\n\n    ```javascript\n    localStorage.setItem('logo', document.getElementById('logo').value);\n    localStorage.getItem('logo');\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n44. ### What are the methods available on session storage\n\n    The session storage provided methods for reading, writing and clearing the session data\n\n    ```javascript\n    // Save data to sessionStorage\n    sessionStorage.setItem('key', 'value');\n\n    // Get saved data from sessionStorage\n    let data = sessionStorage.getItem('key');\n\n    // Remove saved data from sessionStorage\n    sessionStorage.removeItem('key');\n\n    // Remove all saved data from sessionStorage\n    sessionStorage.clear();\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n45. ### What is a storage event and its event handler\n\n    The StorageEvent is an event that fires when a storage area has been changed in the context of another document. Whereas onstorage property is an EventHandler for processing storage events.\n    The syntax would be as below\n\n    ```javascript\n     window.onstorage = functionRef;\n    ```\n\n    Let's take the example usage of onstorage event handler which logs the storage key and it's values\n\n    ```javascript\n    window.onstorage = function(e) {\n      console.log('The ' + e.key +\n        ' key has been changed from ' + e.oldValue +\n        ' to ' + e.newValue + '.');\n    };\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n46. ### Why do you need web storage\n\n    Web storage is more secure, and large amounts of data can be stored locally, without affecting website performance. Also, the information is never transferred to the server. Hence this is a more recommended approach than Cookies.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n47. ### How do you check web storage browser support\n\n    You need to check browser support for localStorage and sessionStorage before using web storage,\n\n    ```javascript\n    if (typeof(Storage) !== \"undefined\") {\n      // Code for localStorage/sessionStorage.\n    } else {\n      // Sorry! No Web Storage support..\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n48. ### How do you check web workers browser support\n\n    You need to check browser support for web workers before using it\n\n    ```javascript\n    if (typeof(Worker) !== \"undefined\") {\n      // code for Web worker support.\n    } else {\n      // Sorry! No Web Worker support..\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n49. ### Give an example of a web worker\n\n    You need to follow below steps to start using web workers for counting example\n    1. Create a Web Worker File:  You need to write a script to increment the count value. Let's name it as counter.js\n\n    ```javascript\n    let i = 0;\n\n    function timedCount() {\n      i = i + 1;\n      postMessage(i);\n      setTimeout(\"timedCount()\",500);\n    }\n\n    timedCount();\n    ```\n\n    Here postMessage() method is used to post a message back to the HTML page\n    1. Create a Web Worker Object: You can create a web worker object by checking for browser support. Let's name this file as web_worker_example.js\n\n    ```javascript\n    if (typeof(w) == \"undefined\") {\n      w = new Worker(\"counter.js\");\n    }\n    ```\n\n    and we can receive messages from web worker\n\n    ```javascript\n    w.onmessage = function(event){\n      document.getElementById(\"message\").innerHTML = event.data;\n    };\n    ```\n\n    1. Terminate a Web Worker:\n    Web workers will continue to listen for messages (even after the external script is finished) until it is terminated. You can use the terminate() method to terminate listening to the messages.\n\n    ```javascript\n    w.terminate();\n    ```\n\n    1. Reuse the Web Worker: If you set the worker variable to undefined you can reuse the code\n\n    ```javascript\n    w = undefined;\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n50. ### What are the restrictions of web workers on DOM\n\n    WebWorkers don't have access to below javascript objects since they are defined in an external files\n    1. Window object\n    2. Document object\n    3. Parent object\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n51. ### What is a promise\n\n    A promise is an object that may produce a single value some time in the future with either a resolved value or a reason that it’s not resolved(for example, network error). It will be in one of the 3 possible states: fulfilled, rejected, or pending.\n\n    The syntax of Promise creation looks like below,\n\n    ```javascript\n        const promise = new Promise(function(resolve, reject) {\n          // promise description\n        })\n    ```\n\n    The usage of a promise would be as below,\n\n    ```javascript\n    const promise = new Promise(resolve =\u003e {\n      setTimeout(() =\u003e {\n        resolve(\"I'm a Promise!\");\n      }, 5000);\n    }, reject =\u003e {\n\n    });\n\n    promise.then(value =\u003e console.log(value));\n    ```\n\n    The action flow of a promise will be as below,\n\n    ![Screenshot](images/promises.png)\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n52. ### Why do you need a promise\n\n    Promises are used to handle asynchronous operations. They provide an alternative approach for callbacks by reducing the callback hell and writing the cleaner code.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n53. ### What are the three states of promise\n\n    Promises have three states:\n    1. **Pending:** This is an initial state of the Promise before an operation begins\n    2. **Fulfilled:** This state indicates that the specified operation was completed.\n    3. **Rejected:** This state indicates that the operation did not complete. In this case an error value will be thrown.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n54. ### What is a callback function\n\n    A callback function is a function passed into another function as an argument. This function is invoked inside the outer function to complete an action.\n    Let's take a simple example of how to use callback function\n\n    ```javascript\n    function callbackFunction(name) {\n      console.log('Hello ' + name);\n    }\n\n    function outerFunction(callback) {\n      let name = prompt('Please enter your name.');\n      callback(name);\n    }\n\n    outerFunction(callbackFunction);\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n55. ### Why do we need callbacks\n\n    The callbacks are needed because javascript is an event driven language. That means instead of waiting for a response javascript will keep executing while listening for other events.\n    Let's take an example with the first function invoking an API call(simulated by setTimeout) and the next function which logs the message.\n\n    ```javascript\n    function firstFunction(){\n      // Simulate a code delay\n      setTimeout( function(){\n        console.log('First function called');\n      }, 1000 );\n    }\n    function secondFunction(){\n      console.log('Second function called');\n    }\n    firstFunction();\n    secondFunction();\n\n    Output\n    // Second function called\n    // First function called\n    ```\n\n    As observed from the output, javascript didn't wait for the response of the first function and the remaining code block got executed. So callbacks are used in a way to make sure that certain code doesn’t execute until the other code finishes execution.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n56. ### What is a callback hell\n\n    Callback Hell is an anti-pattern with multiple nested callbacks which makes code hard to read and debug when dealing with asynchronous logic. The callback hell looks like below,\n\n    ```javascript\n    async1(function(){\n        async2(function(){\n            async3(function(){\n                async4(function(){\n                    ....\n                });\n            });\n        });\n    });\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n57. ### What are server-sent events\n\n    Server-sent events (SSE) is a server push technology enabling a browser to receive automatic updates from a server via HTTP connection without resorting to polling. These are a one way communications channel - events flow from server to client only. This has been used in Facebook/Twitter updates, stock price updates, news feeds etc.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n58. ### How do you receive server-sent event notifications\n\n    The EventSource object is used to receive server-sent event notifications. For example, you can receive messages from server as below,\n\n    ```javascript\n    if(typeof(EventSource) !== \"undefined\") {\n      var source = new EventSource(\"sse_generator.js\");\n      source.onmessage = function(event) {\n        document.getElementById(\"output\").innerHTML += event.data + \"\u003cbr\u003e\";\n      };\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n59. ### How do you check browser support for server-sent events\n\n    You can perform browser support for server-sent events before using it as below,\n\n    ```javascript\n    if(typeof(EventSource) !== \"undefined\") {\n      // Server-sent events supported. Let's have some code here!\n    } else {\n      // No server-sent events supported\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n60. ### What are the events available for server sent events\n\n    Below are the list of events available for server sent events\n    | Event | Description |\n    |---- | ---------\n    | onopen  | It is used when a connection to the server is opened |\n    | onmessage | This event is used when a message is received  |\n    | onerror | It happens when an error occurs|\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n61. ### What are the main rules of promise\n\n    A promise must follow a specific set of rules,\n    1. A promise is an object that supplies a standard-compliant `.then()` method\n    2. A pending promise may transition into either fulfilled or rejected state\n    3. A fulfilled or rejected promise is settled and it must not transition into any other state.\n    4. Once a promise is settled, the value must not change.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n62. ### What is callback in callback\n\n    You can nest one callback inside in another callback to execute the actions sequentially one by one. This is known as callbacks in callbacks.\n\n    ```javascript\n    loadScript('/script1.js', function(script) {\n       console.log('first script is loaded');\n\n      loadScript('/script2.js', function(script) {\n\n        console.log('second script is loaded');\n\n        loadScript('/script3.js', function(script) {\n\n            console.log('third script is loaded');\n          // after all scripts are loaded\n        });\n\n      })\n\n    });\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n63. ### What is promise chaining\n\n    The process of executing a sequence of asynchronous tasks one after another using promises is known as Promise chaining. Let's take an example of promise chaining for calculating the final result,\n\n    ```javascript\n    new Promise(function(resolve, reject) {\n\n      setTimeout(() =\u003e resolve(1), 1000);\n\n    }).then(function(result) {\n\n      console.log(result); // 1\n      return result * 2;\n\n    }).then(function(result) {\n\n      console.log(result); // 2\n      return result * 3;\n\n    }).then(function(result) {\n\n      console.log(result); // 6\n      return result * 4;\n\n    });\n    ```\n\n    In the above handlers, the result is passed to the chain of .then() handlers with the below work flow,\n    1. The initial promise resolves in 1 second,\n    2. After that `.then` handler is called by logging the result(1) and then return a promise with the value of result * 2.\n    3. After that the value passed to the next `.then` handler by logging the result(2) and return a promise with result * 3.\n    4. Finally the value passed to the last `.then` handler by logging the result(6) and return a promise with result * 4.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n64. ### What is promise.all\n\n    Promise.all is a promise that takes an array of promises as an input (an iterable), and it gets resolved when all the promises get resolved or any one of them gets rejected. For example, the syntax of promise.all method is below,\n\n    ```javascript\n    Promise.all([Promise1, Promise2, Promise3]) .then(result) =\u003e {   console.log(result) }) .catch(error =\u003e console.log(`Error in promises ${error}`))\n    ```\n\n    **Note:** Remember that the order of the promises(output the result) is maintained as per input order.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n65. ### What is the purpose of the race method in promise\n\n    Promise.race() method will return the promise instance which is firstly resolved or rejected. Let's take an example of race() method where promise2 is resolved first\n\n    ```javascript\n    var promise1 = new Promise(function(resolve, reject) {\n        setTimeout(resolve, 500, 'one');\n    });\n    var promise2 = new Promise(function(resolve, reject) {\n        setTimeout(resolve, 100, 'two');\n    });\n\n    Promise.race([promise1, promise2]).then(function(value) {\n      console.log(value); // \"two\" // Both promises will resolve, but promise2 is faster\n    });\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n66. ### What is a strict mode in javascript\n\n    Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a “strict” operating context. This way it prevents certain actions from being taken and throws more exceptions. The literal expression `\"use strict\";` instructs the browser to use the javascript code in the Strict mode.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n67. ### Why do you need strict mode\n\n    Strict mode is useful to write \"secure\" JavaScript by notifying \"bad syntax\" into real errors. For example, it eliminates accidentally creating a global variable by throwing an error and also throws an error for assignment to a non-writable property, a getter-only property, a non-existing property, a non-existing variable, or a non-existing object.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n68. ### How do you declare strict mode\n\n    The strict mode is declared by adding \"use strict\"; to the beginning of a script or a function.\n    If declared at the beginning of a script, it has global scope.\n\n    ```javascript\n    \"use strict\";\n    x = 3.14; // This will cause an error because x is not declared\n    ```\n\n    and if you declare inside a function, it has local scope\n\n    ```javascript\n    x = 3.14;       // This will not cause an error.\n    myFunction();\n\n    function myFunction() {\n      \"use strict\";\n      y = 3.14;   // This will cause an error\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n69. ### What is the purpose of double exclamation\n\n    The double exclamation or negation(!!) ensures the resulting type is a boolean. If it was falsey (e.g. 0, null, undefined, etc.), it will be false, otherwise, true.\n    For example, you can test IE version using this expression as below,\n\n    ```javascript\n    let isIE8 = false;\n    isIE8 = !! navigator.userAgent.match(/MSIE 8.0/);\n    console.log(isIE8); // returns true or false\n    ```\n\n    If you don't use this expression then it returns the original value.\n\n    ```javascript\n    console.log(navigator.userAgent.match(/MSIE 8.0/));  // returns either an Array or null\n    ```\n\n    **Note:** The expression !! is not an operator, but it is just twice of ! operator.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n70. ### What is the purpose of the delete operator\n\n    The delete keyword is used to delete the property as well as its value.\n\n    ```javascript\n    var user= {name: \"John\", age:20};\n    delete user.age;\n\n    console.log(user); // {name: \"John\"}\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n71. ### What is the typeof operator\n\n    You can use the JavaScript typeof operator to find the type of a JavaScript variable. It returns the type of a variable or an expression.\n\n    ```javascript\n    typeof \"John Abraham\"     // Returns \"string\"\n    typeof (1 + 2)        // Returns \"number\"\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n72. ### What is undefined property\n\n    The undefined property indicates that a variable has not been assigned a value, or not declared at all. The type of undefined value is undefined too.\n\n    ```javascript\n    var user;    // Value is undefined, type is undefined\n    console.log(typeof(user)) //undefined\n    ```\n\n    Any variable can be emptied by setting the value to undefined.\n\n    ```javascript\n    user = undefined\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n73. ### What is null value\n\n    The value null represents the intentional absence of any object value. It is one of JavaScript's primitive values. The type of null value is object.\n    You can empty the variable by setting the value to null.\n\n    ```javascript\n    var user = null;\n    console.log(typeof(user)) //object\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n74. ### What is the difference between null and undefined\n\n    Below are the main differences between null and undefined,\n\n    | Null | Undefined |\n    |---- | -----------|\n    | It is an assignment value which indicates that variable points to no object.  | It is not an assignment value where a variable has been declared but has not yet been assigned a value. |\n    | Type of null is object | Type of undefined is undefined  |\n    | The null value is a primitive value that represents the null, empty, or non-existent reference. | The undefined value is a primitive value used when a variable has not been assigned a value.|\n    | Indicates the absence of a value for a variable | Indicates absence of variable itself |\n    | Converted to zero (0) while performing primitive operations | Converted to NaN while performing primitive operations |\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n75. ### What is eval\n\n    The eval() function evaluates JavaScript code represented as a string. The string can be a JavaScript expression, variable, statement, or sequence of statements.\n\n    ```javascript\n    console.log(eval('1 + 2')); //  3\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n76. ### What is the difference between window and document\n\n    Below are the main differences between window and document,\n\n    | Window | Document |\n    |---- | ---------\n    | It is the root level element in any web page  | It is the direct child of the window object. This is also known as Document Object Model(DOM) |\n    | By default window object is available implicitly in the page | You can access it via window.document or document.  |\n    | It has methods like alert(), confirm() and properties like document, location | It provides methods like getElementById, getElementByTagName, createElement etc  |\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n77. ### How do you access history in javascript\n\n    The window.history object contains the browser's history. You can load previous and next URLs in the history using back() and next() methods.\n\n    ```javascript\n    function goBack() {\n      window.history.back()\n    }\n    function goForward() {\n      window.history.forward()\n    }\n    ```\n\n    **Note:** You can also access history without window prefix.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n78. ### What are the javascript data types\n\n    Below are the list of javascript data types available\n    1. Number\n    2. String\n    3. Boolean\n    4. Object\n    5. Undefined\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n79. ### What is isNaN\n\n    The isNaN() function is used to determine whether a value is an illegal number (Not-a-Number) or not. i.e, This function returns true if the value equates to NaN. Otherwise it returns false.\n\n    ```javascript\n    isNaN('Hello') //true\n    isNaN('100') //false\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n80. ### What are the differences between undeclared and undefined variables\n\n    Below are the major differences between undeclared and undefined variables,\n\n    | undeclared | undefined |\n    |---- | ---------\n    | These variables do not exist in a program and are not declared  | These variables declared in the program but have not assigned any value |\n    | If you try to read the value of an undeclared variable, then a runtime error is encountered | If you try to read the value of an undefined variable, an undefined value is returned.  |\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n81. ### What are global variables\n\n    Global variables are those that are available throughout the length of the code without any scope. The var keyword is used to declare a local variable but if you omit it then it will become global variable\n\n    ```javascript\n    msg = \"Hello\" // var is missing, it becomes global variable\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n82. ### What are the problems with global variables\n\n    The problem with global variables is the conflict of variable names of local and global scope. It is also difficult to debug and test the code that relies on global variables.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n83. ### What is NaN property\n\n    The NaN property is a global property that represents \"Not-a-Number\" value. i.e, It indicates that a value is not a legal number. It is very rare to use NaN in a program but it can be used as return value for few cases\n\n    ```javascript\n    Math.sqrt(-1)\n    parseInt(\"Hello\")\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n84. ### What is the purpose of isFinite function\n\n    The isFinite() function is used to determine whether a number is a finite, legal number. It returns false if the value is +infinity, -infinity, or NaN (Not-a-Number), otherwise it returns true.\n\n    ```javascript\n    isFinite(Infinity);  // false\n    isFinite(NaN);       // false\n    isFinite(-Infinity); // false\n\n    isFinite(100);         // true\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n85. ### What is an event flow\n\n    Event flow is the order in which event is received on the web page. When you click an element that is nested in various other elements, before your click actually reaches its destination, or target element, it must trigger the click event for each of its parent elements first, starting at the top with the global window object.\n    There are two ways of event flow\n    1. Top to Bottom(Event Capturing)\n    2. Bottom to Top (Event Bubbling)\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n86. ### What is event bubbling\n\n    Event bubbling is a type of event propagation where the event first triggers on the innermost target element, and then successively triggers on the ancestors (parents) of the target element in the same nesting hierarchy till it reaches the outermost DOM element.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n87. ### What is event capturing\n\n    Event capturing is a type of event propagation where the event is first captured by the outermost element, and then successively triggers on the descendants (children) of the target element in the same nesting hierarchy till it reaches the innermost DOM element.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n88. ### How do you submit a form using JavaScript\n\n    You can submit a form using JavaScript use document.form[0].submit(). All the form input's information is submitted using onsubmit event handler\n\n    ```javascript\n    function submit() {\n        document.form[0].submit();\n    }\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n89. ### How do you find operating system details\n\n    The window.navigator object contains information about the visitor's browser OS details. Some of the OS properties are available under platform property,\n\n    ```javascript\n    console.log(navigator.platform);\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n90. ### What is the difference between document load and DOMContentLoaded events\n\n    The `DOMContentLoaded` event is fired when the initial HTML document has been completely loaded and parsed, without waiting for assets(stylesheets, images, and subframes) to finish loading. Whereas The load event is fired when the whole page has loaded, including all dependent resources(stylesheets, images).\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n91. ### What is the difference between native, host and user objects\n\n    `Native objects` are objects that are part of the JavaScript language defined by the ECMAScript specification. For example, String, Math, RegExp, Object, Function etc core objects defined in the ECMAScript spec.\n    `Host objects` are objects provided by the browser or runtime environment (Node). For example, window, XmlHttpRequest, DOM nodes etc are considered as host objects.\n    `User objects` are objects defined in the javascript code. For example, User objects created for profile information.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n92. ### What are the tools or techniques used for debugging JavaScript code\n\n    You can use below tools or techniques for debugging javascript\n    1. Chrome Devtools\n    2. debugger statement\n    3. Good old console.log statement\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n93. ### What are the pros and cons of promises over callbacks\n\n    Below are the list of pros and cons of promises over callbacks,\n\n    **Pros:**\n    1. It avoids callback hell which is unreadable\n    2. Easy to write sequential asynchronous code with .then()\n    3. Easy to write parallel asynchronous code with Promise.all()\n    4. Solves some of the common problems of callbacks(call the callback too late, too early, many times and swallow errors/exceptions)\n\n    **Cons:**\n    1. It makes little complex code\n    2. You need to load a polyfill if ES6 is not supported\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n94. ### What is the difference between an attribute and a property\n\n    Attributes are defined on the HTML markup whereas properties are defined on the DOM. For example, the below HTML element has 2 attributes type and value,\n\n    ```javascript\n    \u003cinput type=\"text\" value=\"Name:\"\u003e\n    ```\n\n    You can retrieve the attribute value as below,\n\n    ```javascript\n    const input = document.querySelector('input');\n    console.log(input.getAttribute('value')); // Good morning\n    console.log(input.value); // Good morning\n    ```\n\n    And after you change the value of the text field to \"Good evening\", it becomes like\n\n    ```javascript\n    console.log(input.getAttribute('value')); // Good morning\n    console.log(input.value); // Good evening\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n95. ### What is same-origin policy\n\n    The same-origin policy is a policy that prevents JavaScript from making requests across domain boundaries. An origin is defined as a combination of URI scheme, hostname, and port number. If you enable this policy then it prevents a malicious script on one page from obtaining access to sensitive data on another web page using Document Object Model(DOM).\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n96. ### What is the purpose of void 0\n\n    Void(0) is used to prevent the page from refreshing. This will be helpful to eliminate the unwanted side-effect, because it will return the undefined primitive value. It is commonly used for HTML documents that use href=\"JavaScript:Void(0);\" within an ```\u003ca\u003e``` element. i.e, when you click a link, the browser loads a new page or refreshes the same page. But this behavior will be prevented using this expression.\n    For example, the below link notify the message without reloading the page\n\n    ```javascript\n    \u003ca href=\"JavaScript:void(0);\" onclick=\"alert('Well done!')\"\u003eClick Me!\u003c/a\u003e\n    ```\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n97. ### Is JavaScript a compiled or interpreted language\n\n    JavaScript is an interpreted language, not a compiled language. An interpreter in the browser reads over the JavaScript code, interprets each line, and runs it. Nowadays  modern browsers use a technology known as Just-In-Time (JIT) compilation, which compiles JavaScript to executable bytecode just as it is about to run.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n98. ### Is JavaScript a case-sensitive language\n\n    Yes, JavaScript is a case sensitive language. The language keywords, variables, function \u0026 object names, and any other identifiers must always be typed with a consistent capitalization of letters.\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n99. ### Is there any relation between Java and JavaScript\n\n    No, they are entirely two different programming languages and have nothing to do with each other. But both of them are Object Oriented Programming languages and like many other languages, they follow similar syntax for basic features(if, else, for, switch, break, continue etc).\n\n    **[⬆ Back to Top](#table-of-contents)**\n\n100. ### What are events\n\n     Events are \"things\" that happen to HTML elements. When JavaScript is used in HTML pages, JavaScript can `react` on these events. Some of the examples of HTML events are,\n\n     1. Web page has finished loading\n     2. Input field was changed\n     3. Button was clicked\n\n     Let's describe the behavior of click event for butt","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajeevranjancom%2Fjavascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frajeevranjancom%2Fjavascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajeevranjancom%2Fjavascript/lists"}