https://github.com/fix2015/interview-questions
A CLI tool for generating interview questions by difficulty level and quantity, with support for multiple output formats including text, JSON, and arrays.
https://github.com/fix2015/interview-questions
array cli command-line-tool difficulty-level filter interview javascript json junior middle nodejs question-bank question-generator questions random-selection senior text top-questions
Last synced: about 1 year ago
JSON representation
A CLI tool for generating interview questions by difficulty level and quantity, with support for multiple output formats including text, JSON, and arrays.
- Host: GitHub
- URL: https://github.com/fix2015/interview-questions
- Owner: fix2015
- Created: 2024-12-14T16:55:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-23T19:05:55.000Z (about 1 year ago)
- Last Synced: 2025-03-28T18:13:59.737Z (about 1 year ago)
- Topics: array, cli, command-line-tool, difficulty-level, filter, interview, javascript, json, junior, middle, nodejs, question-bank, question-generator, questions, random-selection, senior, text, top-questions
- Homepage: https://hackernoon.com/if-you-want-to-learn-javascript-through-the-terminal-this-package-is-for-you
- Size: 2.7 MB
- Stars: 83
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# javascript-questions-pro (619 questions)
## [Levels](./level/) (4)
- [basic](./level/basic)
- [intermediate](./level/intermediate)
- [advanced](./level/advanced)
- [beginner](./level/beginner)
## [Themes](./theme/) (218)
- [indexeddb](./theme/indexeddb)
- [db](./theme/db)
- [storage](./theme/storage)
- [cookie](./theme/cookie)
- [options](./theme/options)
- [local storage](./theme/local_storage)
- [session storage](./theme/session_storage)
- [differences](./theme/differences)
- [delete](./theme/delete)
- [remove](./theme/remove)
- [postmessage](./theme/postmessage)
- [communication](./theme/communication)
- [iframe](./theme/iframe)
- [closures](./theme/closures)
- [javascript](./theme/javascript)
- [scope](./theme/scope)
- [modules](./theme/modules)
- [es6](./theme/es6)
- [classes](./theme/classes)
- [object oriented programming](./theme/object_oriented_programming)
- [benefits](./theme/benefits)
- [organization](./theme/organization)
- [hoisting](./theme/hoisting)
- [variables](./theme/variables)
- [service worker](./theme/service_worker)
- [offline](./theme/offline)
- [caching](./theme/caching)
- [dom manipulation](./theme/dom_manipulation)
- [elements](./theme/elements)
- [persistence](./theme/persistence)
- [database](./theme/database)
- [memoization](./theme/memoization)
- [performance](./theme/performance)
- [prototype](./theme/prototype)
- [inheritance](./theme/inheritance)
- [higher order functions](./theme/higher_order_functions)
- [currying](./theme/currying)
- [functions](./theme/functions)
- [object](./theme/object)
- [map](./theme/map)
- [pure function](./theme/pure_function)
- [functional programming](./theme/functional_programming)
- [let keyword](./theme/let_keyword)
- [arrow functions](./theme/arrow_functions)
- [let](./theme/let)
- [var](./theme/var)
- [git](./theme/git)
- [bisect](./theme/bisect)
- [debugging](./theme/debugging)
- [lambda expressions](./theme/lambda_expressions)
- [splice](./theme/splice)
- [array](./theme/array)
- [slice](./theme/slice)
- [objects](./theme/objects)
- [creation](./theme/creation)
- [rebase](./theme/rebase)
- [version control](./theme/version_control)
- [reflog](./theme/reflog)
- [revert](./theme/revert)
- [storage event](./theme/storage_event)
- [event handler](./theme/event_handler)
- [web storage](./theme/web_storage)
- [sessionstorage](./theme/sessionstorage)
- [localstorage](./theme/localstorage)
- [cookies](./theme/cookies)
- [http](./theme/http)
- [sse](./theme/sse)
- [real time communication](./theme/real_time_communication)
- [web technologies](./theme/web_technologies)
- [callback hell](./theme/callback_hell)
- [asynchronous](./theme/asynchronous)
- [callbacks](./theme/callbacks)
- [asynchronous programming](./theme/asynchronous_programming)
- [callback function](./theme/callback_function)
- [promise](./theme/promise)
- [web workers](./theme/web_workers)
- [dom](./theme/dom)
- [browser support](./theme/browser_support)
- [server sent events](./theme/server_sent_events)
- [notifications](./theme/notifications)
- [promises](./theme/promises)
- [strict mode](./theme/strict_mode)
- [type coercion](./theme/type_coercion)
- [event handling](./theme/event_handling)
- [keyboard events](./theme/keyboard_events)
- [history api](./theme/history_api)
- [security](./theme/security)
- [data types](./theme/data_types)
- [operators](./theme/operators)
- [type checking](./theme/type_checking)
- [best practices](./theme/best_practices)
- [events](./theme/events)
- [syntax](./theme/syntax)
- [math](./theme/math)
- [strings](./theme/strings)
- [algorithm](./theme/algorithm)
- [numbers](./theme/numbers)
- [arrays](./theme/arrays)
- [bit manipulation](./theme/bit_manipulation)
- [namespaces](./theme/namespaces)
- [data structures](./theme/data_structures)
- [validation](./theme/validation)
- [web navigation](./theme/web_navigation)
- [date](./theme/date)
- [url manipulation](./theme/url_manipulation)
- [console](./theme/console)
- [browser events](./theme/browser_events)
- [string manipulation](./theme/string_manipulation)
- [date and time](./theme/date_and_time)
- [date manipulation](./theme/date_manipulation)
- [loops](./theme/loops)
- [web components](./theme/web_components)
- [polyfills](./theme/polyfills)
- [encoding](./theme/encoding)
- [oop](./theme/oop)
- [json](./theme/json)
- [browser features](./theme/browser_features)
- [mobile detection](./theme/mobile_detection)
- [page features](./theme/page_features)
- [environment](./theme/environment)
- [iterables](./theme/iterables)
- [http requests](./theme/http_requests)
- [data formats](./theme/data_formats)
- [forms](./theme/forms)
- [html](./theme/html)
- [internationalization](./theme/internationalization)
- [number formatting](./theme/number_formatting)
- [printing](./theme/printing)
- [regular expressions](./theme/regular_expressions)
- [destructuring](./theme/destructuring)
- [typescript](./theme/typescript)
- [iteration](./theme/iteration)
- [fetch api](./theme/fetch_api)
- [web apis](./theme/web_apis)
- [ui manipulation](./theme/ui_manipulation)
- [features](./theme/features)
- [language concepts](./theme/language_concepts)
- [node js](./theme/node_js)
- [control flow](./theme/control_flow)
- [general knowledge](./theme/general_knowledge)
- [collections](./theme/collections)
- [linked lists](./theme/linked_lists)
- [event loop](./theme/event_loop)
- [v8 engine](./theme/v8_engine)
- [optimization](./theme/optimization)
- [rxjs](./theme/rxjs)
- [control structures](./theme/control_structures)
- [observables](./theme/observables)
- [errors](./theme/errors)
- [generators](./theme/generators)
- [engines](./theme/engines)
- [execution context](./theme/execution_context)
- [window properties](./theme/window_properties)
- [proxy](./theme/proxy)
- [page load](./theme/page_load)
- [design patterns](./theme/design_patterns)
- [web development](./theme/web_development)
- [logical operators](./theme/logical_operators)
- [ajax](./theme/ajax)
- [statements](./theme/statements)
- [concurrency model](./theme/concurrency_model)
- [iterators](./theme/iterators)
- [binary data](./theme/binary_data)
- [tools](./theme/tools)
- [browser](./theme/browser)
- [runtime](./theme/runtime)
- [standards](./theme/standards)
- [global objects](./theme/global_objects)
- [memory](./theme/memory)
- [libraries](./theme/libraries)
- [frameworks](./theme/frameworks)
- [memory management](./theme/memory_management)
- [declarations](./theme/declarations)
- [script tag](./theme/script_tag)
- [comparison](./theme/comparison)
- [array methods](./theme/array_methods)
- [timers](./theme/timers)
- [compatibility](./theme/compatibility)
- [string methods](./theme/string_methods)
- [eval](./theme/eval)
- [conditionals](./theme/conditionals)
- [spread operator](./theme/spread_operator)
- [timing](./theme/timing)
- [error handling](./theme/error_handling)
- [programming paradigms](./theme/programming_paradigms)
- [history](./theme/history)
- [language features](./theme/language_features)
- [concurrency](./theme/concurrency)
- [jest](./theme/jest)
- [testing](./theme/testing)
- [assertions](./theme/assertions)
- [setup and teardown](./theme/setup_and_teardown)
- [mocks](./theme/mocks)
- [snapshot testing](./theme/snapshot_testing)
- [async testing](./theme/async_testing)
- [test management](./theme/test_management)
- [command line](./theme/command_line)
- [implementation](./theme/implementation)
- [operations](./theme/operations)
- [time complexity](./theme/time_complexity)
- [protractor](./theme/protractor)
- [ui testing](./theme/ui_testing)
- [setup](./theme/setup)
- [commands](./theme/commands)
- [locators](./theme/locators)
- [waiting](./theme/waiting)
- [verification](./theme/verification)
- [alerts](./theme/alerts)
- [headless testing](./theme/headless_testing)
- [async await](./theme/async_await)
- [express js](./theme/express_js)
- [algorithms](./theme/algorithms)
- [weakmap](./theme/weakmap)
- [v8](./theme/v8)
- [devtools](./theme/devtools)
- [animation](./theme/animation)
- [multithreading](./theme/multithreading)
- [async](./theme/async)
## [Tutorials with Videos](./video/) (300)
- [What is IndexedDB](https://www.tiktok.com/@jsmentoring/photo/7448276165661314336)
- [What are the options in a cookie](https://www.tiktok.com/@jsmentoring/photo/7448261980567145761)
- [Differences between cookie, local storage and session storage](https://www.tiktok.com/@jsmentoring/photo/7448258461030173985)
- [How do you delete a cookie](https://www.tiktok.com/@jsmentoring/photo/7448236859966197025)
- [What is a post message](https://www.tiktok.com/@jsmentoring/photo/7448205399074934049)
- [What are closures](https://www.tiktok.com/@jsmentoring/photo/7447942704148811041)
- [What are modules](https://www.tiktok.com/@jsmentoring/photo/7447936859029654816)
- [What are classes in ES6](https://www.tiktok.com/@jsmentoring/photo/7447909741977685280)
- [Why do you need modules](https://www.tiktok.com/@jsmentoring/photo/7447895686626020640)
- [What is Hoisting](https://www.tiktok.com/@jsmentoring/photo/7447882385946938656)
- [What is scope in javascript](https://www.tiktok.com/@jsmentoring/photo/7447877473280265505)
- [What is a service worker](https://www.tiktok.com/@jsmentoring/photo/7447871707219594529)
- [How do you manipulate with DOM element](https://www.tiktok.com/@jsmentoring/photo/7447865971974475041)
- [How do you reuse information across service worker restarts](https://www.tiktok.com/@jsmentoring/photo/7447841580880350497)
- [What is IndexedDB](https://www.tiktok.com/@jsmentoring/photo/7447814335323278624)
- [What is memoization](https://www.tiktok.com/@jsmentoring/photo/7447658154155871520)
- [What is memoization](https://www.tiktok.com/@jsmentoring/photo/7447658154155871520)
- [What is a Prototype Chain in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7447534074211601697)
- [What is a higher order function](https://www.tiktok.com/@jsmentoring/photo/7447469800642727200)
- [What is the currying function](https://www.tiktok.com/@jsmentoring/photo/7447172210076208417)
- [How do you compare Object and Map](https://www.tiktok.com/@jsmentoring/photo/7447122335863147808)
- [What is a pure function](https://www.tiktok.com/@jsmentoring/photo/7447104096424725792)
- [What is a Prototype Chain in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7446735468848270625)
- [What is the purpose of the let keyword](https://www.tiktok.com/@jsmentoring/photo/7446499450626772256)
- [Arrow func?](https://www.tiktok.com/@jsmentoring/photo/7446420047448247585)
- [What is the difference between let and var](https://www.tiktok.com/@jsmentoring/photo/7446417854699687200)
- [What is git bisect command?](https://www.tiktok.com/@jsmentoring/photo/7446337497484791073)
- [What are lambda expressions or arrow functions?](https://www.tiktok.com/@jsmentoring/photo/7446080608989678880)
- [What is the difference between == and === operators?](https://www.tiktok.com/@jsmentoring/photo/7446055928723508512)
- [What is the purpose of the array splice method?](https://www.tiktok.com/@jsmentoring/photo/7446035575565520160)
- [What is the difference between slice and splice?](https://www.tiktok.com/@jsmentoring/photo/7446029933446565152)
- [5 Ways to Create Objects in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7445448146685136161)
- [What is git rebase command?](https://www.tiktok.com/@jsmentoring/photo/7444874869394771232)
- [What is git reflog command?](https://www.tiktok.com/@jsmentoring/photo/7444873101717884192)
- [What is git revert command?](https://www.tiktok.com/@jsmentoring/photo/7444867368431439136)
- [What is a storage event and its event handler?](https://www.tiktok.com/@jsmentoring/photo/7448353911720742177)
- [What are the methods available on session storage?](https://www.tiktok.com/@jsmentoring/photo/7448368128825888032)
- [How do you access web storage?](https://www.tiktok.com/@jsmentoring/photo/7448375078183587105)
- [What is the main difference between localStorage and sessionStorage?](https://www.tiktok.com/@jsmentoring/photo/7448379916778851617)
- [Why do you need a Cookie?](https://www.tiktok.com/@jsmentoring/photo/7448385477113171233)
- [What is a Cookie?](https://www.tiktok.com/@jsmentoring/photo/7448395347279236384)
- [What is web storage?](https://www.tiktok.com/@jsmentoring/photo/7448401312728878368)
- [What Are Server-Sent Events (SSE)?](https://www.tiktok.com/@jsmentoring/photo/7448434434774142240)
- [What Is a Callback Hell?](https://www.tiktok.com/@jsmentoring/photo/7448549870673169696)
- [Importance of Callbacks in Javascript?](https://www.tiktok.com/@jsmentoring/photo/7448582345390591265)
- [What is a callback function in javascript?](https://www.tiktok.com/@jsmentoring/photo/7448614606278282529)
- [What Are the Three States of a Promise?](https://www.tiktok.com/@jsmentoring/photo/7448655823150058785)
- [Why do you need a promise?](https://www.tiktok.com/@jsmentoring/photo/7448671709634235681)
- [What is a promise?](https://www.tiktok.com/@jsmentoring/photo/7448715825642540320)
- [What are the restrictions of web workers on DOM?](https://www.tiktok.com/@jsmentoring/photo/7448725365574372641)
- [Give an example of a web worker?](https://www.tiktok.com/@jsmentoring/photo/7448739040213437729)
- [How do you check web storage browser support?](https://www.tiktok.com/@jsmentoring/photo/7448750198848769313)
- [Why do you need web storage?](https://www.tiktok.com/@jsmentoring/photo/7448934582965046561)
- [How Do You Receive Server-Sent Event Notifications?](https://www.tiktok.com/@jsmentoring/photo/7448989685881376033)
- [What Is a Callback in Callback?](https://www.tiktok.com/@jsmentoring/photo/7449011382449720608)
- [What Is Promise Chaining in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449040289345457441)
- [What Are the Main Rules of Promise in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449057432086580513)
- [What Are the Events Available for Server-Sent Events?](https://www.tiktok.com/@jsmentoring/photo/7449065499603881248)
- [How Do You Check Browser Support for Server-Sent Events?](https://www.tiktok.com/@jsmentoring/photo/7449149383142018336)
- [What Is `Promise.all` in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449321820743847200)
- [What Is the Purpose of the `race` Method in Promises?](https://www.tiktok.com/@jsmentoring/photo/7449363438461144353)
- [What Is Strict Mode in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449392707455175968)
- [What Is the Purpose of Double Exclamation in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449429710985022753)
- [How Do You Declare Strict Mode in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449490448533507361)
- [How Do You Detect Caps Lock Key Turned On or Not?](https://www.tiktok.com/@jsmentoring/photo/7449671849920761120)
- [How Do You Access History in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449732288268487969)
- [What Is the Difference Between `window` and `document` in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449755076182215968)
- [What Is the Purpose of Double Exclamation in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449813378895203617)
- [What Is `eval` in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449833381975559446)
- [What Is the `null` Value in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7449876086793489696)
- [What Is the `undefined` Property in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7450179747931278624)
- [What Is the Purpose of the `delete` Operator in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7450258222222560544)
- [What Is the `typeof` Operator in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7450568773712497953)
- [What Is `isNaN` in JavaScript?](https://www.tiktok.com/@jsmentoring/photo/7450774214459673888)
- [What are the differences between undeclared and undefined variables](https://www.tiktok.com/@jsmentoring/photo/7450925531370884385)
- [What are global variables](https://www.tiktok.com/@jsmentoring/photo/7450838618257575201)
- [What are the problems with global variables](https://www.tiktok.com/@jsmentoring/photo/7451163740982070561)
- [What is NaN property](https://www.tiktok.com/@jsmentoring/photo/7451255958266760480)
- [What is an event flow](https://www.tiktok.com/@jsmentoring/photo/7451321489682468128)
- [What is event bubbling](https://www.tiktok.com/@jsmentoring/photo/7451597511862603040)
- [Can I add getters and setters using defineProperty method](https://www.tiktok.com/@jsmentoring/photo/7459755921485434144)
- [Can I use reserved words as identifiers](https://www.tiktok.com/@jsmentoring/photo/7457212868161850657)
- [Can we define properties for functions](https://www.tiktok.com/@jsmentoring/photo/7456170349391023393)
- [Can you apply chaining on conditional operator](https://www.tiktok.com/@jsmentoring/photo/7458016862446570785)
- [Can you give an example of when you really need a semicolon](https://www.tiktok.com/@jsmentoring/photo/7457679188732939553)
- [Can you write a random integers function to print integers within a range](https://www.tiktok.com/@jsmentoring/photo/7456920292397518112)
- [Check for Anagrams](https://www.tiktok.com/@jsmentoring/video/7458386392272473377)
- [Check if a String is a Palindrome](https://www.tiktok.com/@jsmentoring/video/7458413373315681569)
- [Does JavaScript supports namespace](https://www.tiktok.com/@jsmentoring/photo/7464760458570911008)
- [Does the const variable make the value immutable](https://www.tiktok.com/@jsmentoring/photo/7470295229015264544)
- [Find the First Non-Repeating Character](https://www.tiktok.com/@jsmentoring/video/7458383226621529376)
- [Find the Most Frequent Element in an Array](https://www.tiktok.com/@jsmentoring/video/7458418483282316576)
- [Give an example usage of rangeOverflow property](https://www.tiktok.com/@jsmentoring/photo/7465086711412854048)
- [How can you get the list of keys of any object](https://www.tiktok.com/@jsmentoring/photo/7459041201086319905)
- [How do get query string values in javascript](https://www.tiktok.com/@jsmentoring/photo/7455462347759471905)
- [How do get the timezone offset from date](https://www.tiktok.com/@jsmentoring/photo/7468056195111144737)
- [How do I modify the url without reloading the page](https://www.tiktok.com/@jsmentoring/photo/7465055907018263841)
- [How do you add a key value pair in javascript](https://www.tiktok.com/@jsmentoring/photo/7456001248484003104)
- [How do you assign default values to variables](https://www.tiktok.com/@jsmentoring/photo/7456018568077937953)
- [How do you call the constructor of a parent class](https://www.tiktok.com/@jsmentoring/photo/7463621028627959072)
- [How do you change the style of a HTML element](https://www.tiktok.com/@jsmentoring/photo/7456849197690621217)
- [How do you check if a key exists in an object](https://www.tiktok.com/@jsmentoring/photo/7455464658166680864)
- [How do you check if a string starts with another string](https://www.tiktok.com/@jsmentoring/photo/7455819349048315169)
- [How do you check whether a string contains a substring](https://www.tiktok.com/@jsmentoring/photo/7457960152197614880)
- [How do you check whether an array includes a particular value or not](https://www.tiktok.com/@jsmentoring/photo/7464755906626981152)
- [How do you compare scalar arrays](https://www.tiktok.com/@jsmentoring/photo/7466925859719449889)
- [How do you compare two date objects](https://www.tiktok.com/@jsmentoring/photo/7455822418272062752)
- [How do you convert date to another timezone in javascript](https://www.tiktok.com/@jsmentoring/photo/7457198473176190241)
- [How do you copy properties from one object to other](https://www.tiktok.com/@jsmentoring/photo/7458032154656673056)
- [How do you create an infinite loop](https://www.tiktok.com/@jsmentoring/photo/7469423331989622048)
- [How do you create an object with prototype](https://www.tiktok.com/@jsmentoring/photo/7458574988463983904)
- [How do you decode an URL](https://www.tiktok.com/@jsmentoring/photo/7459171752271269153)
- [How do you define JSON arrays](https://www.tiktok.com/@jsmentoring/photo/7456895653067672864)
- [How do you define multiline strings](https://www.tiktok.com/@jsmentoring/photo/7456061031811419424)
- [How do you define multiple properties on an object](https://www.tiktok.com/@jsmentoring/photo/7462833020551187745)
- [How do you define property on Object constructor](https://www.tiktok.com/@jsmentoring/photo/7459536638176234785)
- [How do you detect a browser language preference](https://www.tiktok.com/@jsmentoring/photo/7459014680225303841)
- [How do you detect a mobile browser without regexp](https://www.tiktok.com/@jsmentoring/photo/7457202437292674337)
- [How do you detect javascript disabled in the page](https://www.tiktok.com/@jsmentoring/photo/7457508448763120928)
- [How do you determine if an object is sealed or not](https://www.tiktok.com/@jsmentoring/photo/7459001015438822689)
- [How do you determine two values same or not using object](https://www.tiktok.com/@jsmentoring/photo/7457684535661137185)
- [How do you determine whether object is frozen or not](https://www.tiktok.com/@jsmentoring/photo/7457681827478785312)
- [How do you display the current date in javascript](https://www.tiktok.com/@jsmentoring/photo/7458949968116682016)
- [How do you encode an URL](https://www.tiktok.com/@jsmentoring/photo/7459156073719680289)
- [How do you extend classes](https://www.tiktok.com/@jsmentoring/photo/7466566601702133024)
- [How do you find min and max value in an array](https://www.tiktok.com/@jsmentoring/photo/7462491684585147681)
- [How do you find min and max values without Math functions](https://www.tiktok.com/@jsmentoring/photo/7462011912289570080)
- [How do you find operating system details](https://www.tiktok.com/@jsmentoring/photo/7451589366285126944)
- [How do you generate random integers](https://www.tiktok.com/@jsmentoring/photo/7456916623870512417)
- [How do you get enumerable key and value pairs](https://www.tiktok.com/@jsmentoring/photo/7458348252274920736)
- [How do you get metadata of a module](https://www.tiktok.com/@jsmentoring/photo/7462493057984761121)
- [How do you get property descriptors of an object](https://www.tiktok.com/@jsmentoring/photo/7466604525500042528)
- [How do you get the current url with javascript](https://www.tiktok.com/@jsmentoring/photo/7458367254942502177)
- [How do you get the image width and height using JS](https://www.tiktok.com/@jsmentoring/photo/7457292452945268000)
- [How do you get the prototype of an object](https://www.tiktok.com/@jsmentoring/photo/7463608944322186528)
- [How do you load CSS and JS files dynamically](https://www.tiktok.com/@jsmentoring/photo/7468342228621020448)
- [How do you loop through or enumerate javascript object](https://www.tiktok.com/@jsmentoring/photo/7455466200588389664)
- [How do you make asynchronous HTTP request](https://www.tiktok.com/@jsmentoring/photo/7457281321589656864)
- [How do you make first letter of the string in an uppercase](https://www.tiktok.com/@jsmentoring/photo/7456035524420062497)
- [How do you make synchronous HTTP request](https://www.tiktok.com/@jsmentoring/photo/7457614380205739296)
- [How do you parse JSON string](https://www.tiktok.com/@jsmentoring/photo/7457955955557403937)
- [How do you perform form validation using JavaScript](https://www.tiktok.com/@jsmentoring/photo/7464738741056294177)
- [How do you perform form validation without JavaScript](https://www.tiktok.com/@jsmentoring/photo/7463632026873122081)
- [How do you perform language specific date and time formatting](https://www.tiktok.com/@jsmentoring/photo/7460895683747286304)
- [How do you prevent an object to extend](https://www.tiktok.com/@jsmentoring/photo/7463226904930258209)
- [How do you print numbers with commas as thousand separators](https://www.tiktok.com/@jsmentoring/photo/7467333374668049696)
- [How do you print the contents of web page](https://www.tiktok.com/@jsmentoring/photo/7459302428265942305)
- [How do you redirect new page in javascript](https://www.tiktok.com/@jsmentoring/photo/7453541079804169504)
- [How do you reverse an array](https://www.tiktok.com/@jsmentoring/photo/7461767458592918816)
- [How do you search a string for a pattern](https://www.tiktok.com/@jsmentoring/photo/7456824435211816224)
- [How do you set prototype of one object to another](https://www.tiktok.com/@jsmentoring/photo/7463628446049127712)
- [How do you sort elements in an array](https://www.tiktok.com/@jsmentoring/photo/7461738847261478177)
- [How do you submit a form using JavaScript](https://www.tiktok.com/@jsmentoring/photo/7454702289975119136)
- [How do you swap variables in destructuring assignment](https://www.tiktok.com/@jsmentoring/photo/7472310346334620950)
- [How do you test for an empty object](https://www.tiktok.com/@jsmentoring/photo/7455470039198682401)
- [How do you trim a string at the beginning or ending](https://www.tiktok.com/@jsmentoring/photo/7473639282557652246)
- [How do you trim a string in javascript](https://www.tiktok.com/@jsmentoring/photo/7455853408113675552)
- [How do you validate an email in javascript](https://www.tiktok.com/@jsmentoring/photo/7456043510161067296)
- [How do you write multi-line strings in template literals](https://www.tiktok.com/@jsmentoring/photo/7469863541760101664)
- [How does synchronous iteration works](https://www.tiktok.com/@jsmentoring/photo/7460552114478140705)
- [How to convert string to title case with javascript](https://www.tiktok.com/@jsmentoring/photo/7457578972889615648)
- [How to get the value from get parameters](https://www.tiktok.com/@jsmentoring/photo/7467643182990249249)
- [How to set the cursor to wait](https://www.tiktok.com/@jsmentoring/photo/7469414701550603553)
- [Is enums feature available in JavaScript](https://www.tiktok.com/@jsmentoring/photo/7464749346089749792)
- [Is it recommended to use eval](https://www.tiktok.com/@jsmentoring/photo/7456751494948293920)
- [Is JavaScript a case-sensitive language](https://www.tiktok.com/@jsmentoring/photo/7454353440626445601)
- [Is JavaScript a compiled or interpreted language](https://www.tiktok.com/@jsmentoring/photo/7454351953959652640)
- [Is the !-- notation represents a special operator](https://www.tiktok.com/@jsmentoring/photo/7456013855827791137)
- [Is there any relation between Java and JavaScript](https://www.tiktok.com/@jsmentoring/photo/7454554999335537952)
- [List down some of the features of ES6](https://www.tiktok.com/@jsmentoring/photo/7469439568199142689)
- [List down the collection of methods available on WeakMap](https://www.tiktok.com/@jsmentoring/photo/7459137346080869665)
- [List down the collection of methods available on WeakSet](https://www.tiktok.com/@jsmentoring/photo/7458291433980579105)
- [What are break and continue statements](https://www.tiktok.com/@jsmentoring/photo/7456440125774433569)
- [What are default parameters](https://www.tiktok.com/@jsmentoring/photo/7470673054704635158)
- [What are default values in destructuring assignment](https://www.tiktok.com/@jsmentoring/photo/7471727005394930966)
- [What are dynamic imports](https://www.tiktok.com/@jsmentoring/photo/7472877947460799766)
- [What are enhanced object literals](https://www.tiktok.com/@jsmentoring/photo/7472498912625003798)
- [What are events](https://www.tiktok.com/@jsmentoring/photo/7454560520000113952)
- [What are javascript accessors](https://www.tiktok.com/@jsmentoring/photo/7459533167528119585)
- [What are JS labels](https://www.tiktok.com/@jsmentoring/photo/7456494402261798177)
- [What are modifiers in regular expression](https://www.tiktok.com/@jsmentoring/photo/7456586559056268576)
- [What are nesting templates](https://www.tiktok.com/@jsmentoring/photo/7469447667714690337)
- [What are primitive data types](https://www.tiktok.com/@jsmentoring/photo/7459714568466484513)
- [What are PWAs](https://www.tiktok.com/@jsmentoring/photo/7453553728059215136)
- [What are raw strings](https://www.tiktok.com/@jsmentoring/photo/7471026585861164310)
- [What are regular expression patterns](https://www.tiktok.com/@jsmentoring/photo/7456908944020196641)
- [What are tagged templates](https://www.tiktok.com/@jsmentoring/photo/7469507120082324768)
- [What are the advantages of Getters and Setters](https://www.tiktok.com/@jsmentoring/photo/7459673228697554208)
- [What are the advantages of Minification](https://www.tiktok.com/@jsmentoring/photo/7463246833825991969)
- [What are the advantages of module loaders](https://www.tiktok.com/@jsmentoring/photo/7472504525740379414)
- [What are the advantages of TypeScript over JavaScript](https://www.tiktok.com/@jsmentoring/photo/7462837290327395617)
- [What are the applications of assign method](https://www.tiktok.com/@jsmentoring/photo/7458036822975712544)
- [What are the applications of seal method](https://www.tiktok.com/@jsmentoring/photo/7458730878810770720)
- [What are the available constraint validation DOM properties](https://www.tiktok.com/@jsmentoring/photo/7464745553981672736)
- [What are the benefits of initializing variables](https://www.tiktok.com/@jsmentoring/photo/7456552071349751073)
- [What are the benefits of keeping declarations at the top](https://www.tiktok.com/@jsmentoring/photo/7456506923873996065)
- [What are the bitwise operators available in javascript](https://www.tiktok.com/@jsmentoring/video/7457690353714433312)
- [What are the common tools used for Minification](https://www.tiktok.com/@jsmentoring/photo/7463234648185916705)
- [What are the conventions to be followed for the usage of switch case](https://www.tiktok.com/@jsmentoring/photo/7459772144747105568)
- [What are the differences between JavaScript and TypeScript](https://www.tiktok.com/@jsmentoring/photo/7462815493494197536)
- [What are the differences between Obfuscation and Encryption](https://www.tiktok.com/@jsmentoring/photo/7463193138585292065)
- [What are the differences between WeakMap and Map](https://www.tiktok.com/@jsmentoring/photo/7458189087422401825)
- [What are the differences between WeakSet and Set](https://www.tiktok.com/@jsmentoring/photo/7458240152905846048)
- [What are the different error names from error object](https://www.tiktok.com/@jsmentoring/photo/7460435743840718113)
- [What are the different methods to find HTML elements in DOM](https://www.tiktok.com/@jsmentoring/photo/7468425060965960993)
- [What are the different ways to make an object non-extensible](https://www.tiktok.com/@jsmentoring/photo/7462880139987209505)
- [What are the DOM methods available for constraint validation](https://www.tiktok.com/@jsmentoring/photo/7466219893701053728)
- [What are the function parameter rules](https://www.tiktok.com/@jsmentoring/photo/7459895386811976992)
- [What are the list of validity properties](https://www.tiktok.com/@jsmentoring/photo/7466576921191583008)
- [What are the properties of Intl object](https://www.tiktok.com/@jsmentoring/photo/7461735308938235168)
- [What are the properties used to get size of window](https://www.tiktok.com/@jsmentoring/photo/7456924943062715680)
- [What are the pros and cons of promises over callbacks](https://www.tiktok.com/@jsmentoring/photo/7453226425227726112)
- [What are the recommendations to create new object](https://www.tiktok.com/@jsmentoring/photo/7456561892916563233)
- [What are the steps involved in return false usage](https://www.tiktok.com/@jsmentoring/photo/7456163504303787297)
- [What are the syntax rules of JSON](https://www.tiktok.com/@jsmentoring/photo/7453777976652467489)
- [What are the tools or techniques used for debugging JavaScript code](https://www.tiktok.com/@jsmentoring/photo/7454541000824917281)
- [What are the two types of loops in javascript](https://www.tiktok.com/@jsmentoring/photo/7460508135346687265)
- [What are the use cases for dynamic imports](https://www.tiktok.com/@jsmentoring/photo/7472500779358686486)
- [What are the various URL properties of location object](https://www.tiktok.com/@jsmentoring/photo/7455459948529487136)
- [What are the ways to execute javascript after page load](https://www.tiktok.com/@jsmentoring/photo/7457929884061469985)
- [What are typed arrays](https://www.tiktok.com/@jsmentoring/photo/7473277864649968918)
- [What are various operators supported by javascript](https://www.tiktok.com/@jsmentoring/photo/7457453251810561313)
- [What happens If I pass string type for getPrototype method](https://www.tiktok.com/@jsmentoring/photo/7463635925373947169)
- [What happens if you write constructor more than once in a class](https://www.tiktok.com/@jsmentoring/photo/7463617735281347873)
- [What is a comma operator](https://www.tiktok.com/@jsmentoring/photo/7462513246734535969)
- [What is a conditional operator in javascript](https://www.tiktok.com/@jsmentoring/photo/7457925912974216481)
- [What is a constructor method](https://www.tiktok.com/@jsmentoring/photo/7462819474555653408)
- [What is a debugger statement](https://www.tiktok.com/@jsmentoring/photo/7457945315644165408)
- [What is a decorator](https://www.tiktok.com/@jsmentoring/photo/7460446342461099296)
- [What is a freeze method](https://www.tiktok.com/@jsmentoring/photo/7457554518977285408)
- [What is a polyfill](https://www.tiktok.com/@jsmentoring/photo/7456405893618437409)
- [What is a proxy object](https://www.tiktok.com/@jsmentoring/photo/7458050469735320865)
- [What is a RegExp object](https://www.tiktok.com/@jsmentoring/photo/7456579932475362592)
- [What is a Regular Expression](https://www.tiktok.com/@jsmentoring/photo/7456774238825925920)
- [What is a rest parameter](https://www.tiktok.com/@jsmentoring/photo/7457471528330988832)
- [What is a WeakMap](https://www.tiktok.com/@jsmentoring/photo/7458221758114516256)
- [What is a WeakSet](https://www.tiktok.com/@jsmentoring/photo/7461719258490211617)
- [What is an anonymous function](https://www.tiktok.com/@jsmentoring/photo/7459468048118861089)
- [What is an app shell model](https://www.tiktok.com/@jsmentoring/photo/7456136059966049568)
- [What is an arguments object](https://www.tiktok.com/@jsmentoring/photo/7455473337897061664)
- [What is an empty statement and purpose of it](https://www.tiktok.com/@jsmentoring/photo/7462028520613547296)
- [What is an enum](https://www.tiktok.com/@jsmentoring/photo/7465480690658725152)
- [What is an error object](https://www.tiktok.com/@jsmentoring/photo/7460422441794391329)
- [What is an event delegation](https://www.tiktok.com/@jsmentoring/photo/7455085016050060576)
- [What is an event queue](https://www.tiktok.com/@jsmentoring/photo/7461560136851639585)
- [What is an Intl object](https://www.tiktok.com/@jsmentoring/photo/7461350028158815521)
- [What is an Iterator](https://www.tiktok.com/@jsmentoring/photo/7460104729561992481)
- [What is an object initializer](https://www.tiktok.com/@jsmentoring/photo/7463237018944916769)
- [What is an Unary operator](https://www.tiktok.com/@jsmentoring/photo/7461747077505109281)
- [What is BOM](https://www.tiktok.com/@jsmentoring/photo/7454626475623468320)
- [What is call stack](https://www.tiktok.com/@jsmentoring/photo/7460132409997069601)
- [What is destructuring assignment](https://www.tiktok.com/@jsmentoring/photo/7470674451730910486)
- [What is ECMAScript](https://www.tiktok.com/@jsmentoring/photo/7453531864133815584)
- [What is ES6](https://www.tiktok.com/@jsmentoring/photo/7469442691240185121)
- [What is event capturing](https://www.tiktok.com/@jsmentoring/photo/7451534594895056160)
- [What is JSON](https://www.tiktok.com/@jsmentoring/photo/7456025885263629601)
- [What is MEAN in JavaScript](https://www.tiktok.com/@jsmentoring/photo/7463877222730911008)
- [What is microtask](https://www.tiktok.com/@jsmentoring/photo/7459906574425902368)
- [What is Minification](https://www.tiktok.com/@jsmentoring/photo/7462868427363994913)
- [What Is Obfuscation in JavaScript](https://www.tiktok.com/@jsmentoring/photo/7462863313496509729)
- [What is optional chaining?](https://www.tiktok.com/@jsmentoring/photo/7459817458866687264)
- [What is same-origin policy](https://www.tiktok.com/@jsmentoring/photo/7454519704300948768)
- [What is the advantage of a comma operator](https://www.tiktok.com/@jsmentoring/photo/7462499238195236128)
- [What is the difference between an attribute and a property](https://www.tiktok.com/@jsmentoring/photo/7453198212661382432)
- [What is the difference between document load and DOMContentLoaded events](https://www.tiktok.com/@jsmentoring/photo/7451559472939437344)
- [What is the difference between Java and JavaScript](https://www.tiktok.com/@jsmentoring/photo/7468299270974754081)
- [What is the difference between native, host and user objects](https://www.tiktok.com/@jsmentoring/photo/7451546871723576608)
- [What is the difference between uneval and eval](https://www.tiktok.com/@jsmentoring/photo/7459446884436905249)
- [What is the main difference between Object.values and Object.entries method](https://www.tiktok.com/@jsmentoring/photo/7458282098579737889)
- [What is the need of tree shaking](https://www.tiktok.com/@jsmentoring/photo/7456574498947599648)
- [What is the output of below spread operator array](https://www.tiktok.com/@jsmentoring/photo/7457941742650789152)
- [What is the output of the following for loops](https://www.tiktok.com/@jsmentoring/photo/7469419711726488865)
- [What is the precedence order between local and global variables](https://www.tiktok.com/@jsmentoring/photo/7459521760090787105)
- [What is the purpose JSON stringify](https://www.tiktok.com/@jsmentoring/photo/7458382016141200673)
- [What is the purpose of breakpoints in debugging](https://www.tiktok.com/@jsmentoring/photo/7457249779840486688)
- [What is the purpose of clearInterval method](https://www.tiktok.com/@jsmentoring/photo/7457687525340089633)
- [What is the purpose of clearTimeout method](https://www.tiktok.com/@jsmentoring/photo/7453583130859949344)
- [What is the purpose of compareFunction while sorting arrays](https://www.tiktok.com/@jsmentoring/photo/7461759054034128161)
- [What is the purpose of exec method](https://www.tiktok.com/@jsmentoring/photo/7456816176019082529)
- [What is the purpose of seal method](https://www.tiktok.com/@jsmentoring/photo/7458057057950895392)
- [What is the purpose of switch-case](https://www.tiktok.com/@jsmentoring/photo/7459766080223841569)
- [What is the purpose of uneval](https://www.tiktok.com/@jsmentoring/photo/7459148995630337313)
- [What is the purpose of void 0](https://www.tiktok.com/@jsmentoring/video/7454350834697080096)
- [What is the use of preventDefault method](https://www.tiktok.com/@jsmentoring/photo/7454611976598113568)
- [What is the use of setInterval](https://www.tiktok.com/@jsmentoring/photo/7455059689315896609)
- [What is the use of setTimeout](https://www.tiktok.com/@jsmentoring/photo/7453766380433722656)
- [What is the use of stopPropagation method](https://www.tiktok.com/@jsmentoring/photo/7454613743649951008)
- [What is the way to find the number of parameters expected by a function](https://www.tiktok.com/@jsmentoring/photo/7456397129393704224)
- [What is tree shaking](https://www.tiktok.com/@jsmentoring/photo/7456569241815354657)
- [What is V8 JavaScript engine](https://www.tiktok.com/@jsmentoring/photo/7468430768063122721)
- [What would be the result of 1+2+'3'](https://www.tiktok.com/@jsmentoring/photo/7456799873505987873)
- [When you get a syntax error](https://www.tiktok.com/@jsmentoring/photo/7460430178938834209)
- [Who created JavaScript](https://www.tiktok.com/@jsmentoring/photo/7454609808038153504)
- [Why do I need to use freeze method](https://www.tiktok.com/@jsmentoring/photo/7457632028364737825)
- [Why do we call javascript as dynamic language](https://www.tiktok.com/@jsmentoring/photo/7468752457196162337)
- [Why do you need JSON](https://www.tiktok.com/@jsmentoring/photo/7453770486993014049)
- [Why do you need to avoid with statement](https://www.tiktok.com/@jsmentoring/photo/7469541897426586913)
- [Why is JavaScript treated as Single threaded](https://www.tiktok.com/@jsmentoring/photo/7455079370881879329)
- [How to catch errors in callbacks](https://www.tiktok.com/@jsmentoring/photo/7458362542088277281)
- [What are weak references?](https://www.tiktok.com/@jsmentoring/photo/7458291433980579105)
## All questions
### What is IndexedDB?
IndexedDB is a low-level API for storing large amounts of structured data, including files and blobs. It allows developers to perform advanced queries and store data persistently in a user's browser. This API is particularly useful for web applications that need to work offline or require local storage beyond simple key-value pairs.
**Tags**: [basic](./level/basic), [IndexedDB](./theme/indexeddb), [db](./theme/db), [storage](./theme/storage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448276165661314336](https://www.tiktok.com/@jsmentoring/photo/7448276165661314336)
---
### What are the options in a cookie?
Cookies have several options to control their behavior, such as `path`, `domain`, `secure`, `HttpOnly`, and `SameSite`. These options help define the scope, security, and accessibility of the cookie.
**Tags**: [basic](./level/basic), [cookie](./theme/cookie), [options](./theme/options), [storage](./theme/storage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448261980567145761](https://www.tiktok.com/@jsmentoring/photo/7448261980567145761)
---
### Differences between cookie, local storage, and session storage
Cookies are primarily used for server communication and have size limitations. Local storage provides persistent client-side storage with no expiration, while session storage stores data for the duration of a session.
**Tags**: [basic](./level/basic), [cookie](./theme/cookie), [local storage](./theme/local_storage), [session storage](./theme/session_storage), [differences](./theme/differences)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448258461030173985](https://www.tiktok.com/@jsmentoring/photo/7448258461030173985)
---
### How do you delete a cookie?
To delete a cookie, set its expiration date to a past date using the `Set-Cookie` header or JavaScript's `document.cookie`. Ensure you match the path and domain attributes of the cookie.
**Tags**: [intermediate](./level/intermediate), [cookie](./theme/cookie), [delete](./theme/delete), [remove](./theme/remove)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448236859966197025](https://www.tiktok.com/@jsmentoring/photo/7448236859966197025)
---
### What is a post message?
The `postMessage` API allows secure communication between a parent window and iframes or between different windows. It is commonly used for cross-origin communication in web applications.
**Tags**: [intermediate](./level/intermediate), [postMessage](./theme/postmessage), [communication](./theme/communication), [iframe](./theme/iframe)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448205399074934049](https://www.tiktok.com/@jsmentoring/photo/7448205399074934049)
---
### What are closures?
Closures in JavaScript occur when a function retains access to its lexical scope even after the function in which it was defined has completed execution. They enable powerful programming patterns like encapsulation and callbacks.
**Tags**: [intermediate](./level/intermediate), [closures](./theme/closures), [JavaScript](./theme/javascript), [scope](./theme/scope)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447942704148811041](https://www.tiktok.com/@jsmentoring/photo/7447942704148811041)
---
### What are modules?
Modules are reusable blocks of code that can be imported and exported in JavaScript. They help organize and encapsulate functionality, promoting maintainable and modular codebases.
**Tags**: [intermediate](./level/intermediate), [modules](./theme/modules), [JavaScript](./theme/javascript), [ES6](./theme/es6)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447936859029654816](https://www.tiktok.com/@jsmentoring/photo/7447936859029654816)
---
### What are classes in ES6?
Classes in ES6 provide a syntax for object-oriented programming in JavaScript. They include constructors, methods, and inheritance, making it easier to create and manage objects.
**Tags**: [advanced](./level/advanced), [classes](./theme/classes), [ES6](./theme/es6), [object-oriented programming](./theme/object_oriented_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447909741977685280](https://www.tiktok.com/@jsmentoring/photo/7447909741977685280)
---
### Why do you need modules?
Modules help organize code into manageable pieces, improve reusability, and avoid global namespace pollution. They also make dependency management and code maintenance easier.
**Tags**: [intermediate](./level/intermediate), [modules](./theme/modules), [benefits](./theme/benefits), [organization](./theme/organization)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447895686626020640](https://www.tiktok.com/@jsmentoring/photo/7447895686626020640)
---
### What is Hoisting?
Hoisting in JavaScript refers to the process where variable and function declarations are moved to the top of their scope during compilation. This allows variables to be used before they are declared.
**Tags**: [basic](./level/basic), [hoisting](./theme/hoisting), [JavaScript](./theme/javascript), [scope](./theme/scope)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447882385946938656](https://www.tiktok.com/@jsmentoring/photo/7447882385946938656)
---
### What is scope in JavaScript?\n\nScope determines the accessibility of variables and functions in JavaScript. There are two types of scope: global and local. Modern JavaScript also includes block scope with \`let\` and \`const\`.
**Tags**: [basic](./level/basic), [scope](./theme/scope), [JavaScript](./theme/javascript), [variables](./theme/variables)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447877473280265505](https://www.tiktok.com/@jsmentoring/photo/7447877473280265505)
---
### What is a service worker?
A service worker is a script that runs in the background, separate from the web page, enabling features like offline functionality, push notifications, and background sync. It acts as a proxy between the web app and the network.
**Tags**: [advanced](./level/advanced), [service worker](./theme/service_worker), [offline](./theme/offline), [caching](./theme/caching)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447871707219594529](https://www.tiktok.com/@jsmentoring/photo/7447871707219594529)
---
### How do you manipulate a DOM element?
To manipulate DOM elements, use methods like `document.getElementById`, `document.querySelector`, and properties like `.innerHTML`, `.style`, or methods like `appendChild` and `removeChild` to modify elements dynamically.
**Tags**: [basic](./level/basic), [DOM manipulation](./theme/dom_manipulation), [JavaScript](./theme/javascript), [elements](./theme/elements)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447865971974475041](https://www.tiktok.com/@jsmentoring/photo/7447865971974475041)
---
### How do you reuse information across service worker restarts?
To reuse information across service worker restarts, store data in persistent storage mechanisms like IndexedDB or localStorage. This ensures data remains accessible even when the service worker restarts.
**Tags**: [advanced](./level/advanced), [service worker](./theme/service_worker), [persistence](./theme/persistence), [IndexedDB](./theme/indexeddb)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447841580880350497](https://www.tiktok.com/@jsmentoring/photo/7447841580880350497)
---
### What is IndexedDB?
IndexedDB is a low-level API for storing large amounts of structured data, including files and blobs. It allows advanced querying and persistent storage, making it ideal for offline-capable applications.
**Tags**: [advanced](./level/advanced), [IndexedDB](./theme/indexeddb), [database](./theme/database), [storage](./theme/storage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447814335323278624](https://www.tiktok.com/@jsmentoring/photo/7447814335323278624)
---
### What is memoization?
Memoization is an optimization technique where function results are cached based on input arguments, avoiding redundant computations and improving performance.
**Tags**: [intermediate](./level/intermediate), [memoization](./theme/memoization), [caching](./theme/caching), [performance](./theme/performance)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447658154155871520](https://www.tiktok.com/@jsmentoring/photo/7447658154155871520)
---
### What is memoization?
Memoization is an optimization technique where function results are cached based on input arguments, avoiding redundant computations and improving performance.
**Tags**: [intermediate](./level/intermediate), [memoization](./theme/memoization), [caching](./theme/caching), [performance](./theme/performance)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447658154155871520](https://www.tiktok.com/@jsmentoring/photo/7447658154155871520)
---
### What is a Prototype Chain in JavaScript?
The prototype chain is a fundamental concept in JavaScript's inheritance model. Every object in JavaScript has a prototype, which is another object. When you access a property of an object, JavaScript will first look for it in the object itself. If not found, it will look in the object's prototype, and then the prototype's prototype, and so on, until it reaches `null`.
**Tags**: [basic](./level/basic), [prototype](./theme/prototype), [inheritance](./theme/inheritance), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447534074211601697](https://www.tiktok.com/@jsmentoring/photo/7447534074211601697)
---
### What is a higher order function?
A higher order function is a function that either takes one or more functions as arguments, returns a function, or both. This allows for more abstract and reusable code. Examples of higher order functions include `map()`, `filter()`, and `reduce()` in JavaScript.
**Tags**: [intermediate](./level/intermediate), [higher order functions](./theme/higher_order_functions), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447469800642727200](https://www.tiktok.com/@jsmentoring/photo/7447469800642727200)
---
### What is the currying function?
Currying is a technique in functional programming where a function that takes multiple arguments is transformed into a sequence of functions, each taking a single argument. This can make the code more modular and reusable. For example, `function add(a) { return function(b) { return a + b; } }`.
**Tags**: [advanced](./level/advanced), [currying](./theme/currying), [functions](./theme/functions), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447172210076208417](https://www.tiktok.com/@jsmentoring/photo/7447172210076208417)
---
### How do you compare Object and Map?
Both `Object` and `Map` are key-value stores in JavaScript, but they have differences:
1. **Key Types**: `Map` can use any data type as a key, while `Object` keys are always converted to strings.
2. **Iteration**: `Map` preserves the order of insertion, while `Object` does not guarantee order.
3. **Performance**: `Map` is generally more efficient for frequent additions and removals of key-value pairs.
**Tags**: [advanced](./level/advanced), [Object](./theme/object), [Map](./theme/map), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447122335863147808](https://www.tiktok.com/@jsmentoring/photo/7447122335863147808)
---
### What is a pure function?
A pure function is a function that, given the same input, will always return the same output and does not have any side effects. It does not modify any external state or depend on external variables. This makes pure functions predictable and easier to test, as well as a key concept in functional programming.
**Tags**: [advanced](./level/advanced), [pure function](./theme/pure_function), [functional programming](./theme/functional_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7447104096424725792](https://www.tiktok.com/@jsmentoring/photo/7447104096424725792)
---
### What is a Prototype Chain in JavaScript?
The prototype chain is a fundamental concept in JavaScript's inheritance model. Every object in JavaScript has a prototype, which is another object. When you access a property of an object, JavaScript will first look for it in the object itself. If not found, it will look in the object's prototype, and then the prototype's prototype, and so on, until it reaches `null`.
**Tags**: [basic](./level/basic), [prototype](./theme/prototype), [inheritance](./theme/inheritance), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446735468848270625](https://www.tiktok.com/@jsmentoring/photo/7446735468848270625)
---
### What is the purpose of the let keyword?
The `let` keyword in JavaScript is used to declare block-scoped variables. Unlike `var`, which declares variables globally or within a function scope, `let` restricts the variable's scope to the block, statement, or expression in which it is used. This makes `let` more predictable and avoids issues with variable hoisting.
**Tags**: [basic](./level/basic), [let keyword](./theme/let_keyword), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446499450626772256](https://www.tiktok.com/@jsmentoring/photo/7446499450626772256)
---
### Arrow func?
Arrow functions in JavaScript are a shorter syntax for writing functions. They are defined using `=>` and do not have their own `this` value, which means they inherit `this` from the surrounding context. This makes them useful in situations like event handling and callbacks where `this` behavior can be tricky.
**Tags**: [basic](./level/basic), [arrow functions](./theme/arrow_functions), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446420047448247585](https://www.tiktok.com/@jsmentoring/photo/7446420047448247585)
---
### What is the difference between let and var?
The primary differences between `let` and `var` are their scoping rules and hoisting behavior:
1. **Scope**: `let` is block-scoped, while `var` is function-scoped.
2. **Hoisting**: Both `let` and `var` are hoisted to the top of their scope, but `let` is not initialized until the code execution reaches it, leading to a Temporal Dead Zone (TDZ).
**Tags**: [basic](./level/basic), [let](./theme/let), [var](./theme/var), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446417854699687200](https://www.tiktok.com/@jsmentoring/photo/7446417854699687200)
---
### What is git bisect command?
The `git bisect` command is used to find the commit that introduced a bug by performing a binary search. You start by marking a known good commit and a known bad commit. Git then checks out the midpoint commit, and you test it. Based on the result, Git narrows down the range of commits until the problematic one is found.
**Tags**: [advanced](./level/advanced), [git](./theme/git), [bisect](./theme/bisect), [debugging](./theme/debugging)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446337497484791073](https://www.tiktok.com/@jsmentoring/photo/7446337497484791073)
---
### What are lambda expressions or arrow functions?
Lambda expressions, also known as arrow functions, are a concise way to write functions in JavaScript. They use the `=>` syntax and do not have their own `this` value, meaning they inherit `this` from the surrounding context. They are often used for short, anonymous functions in callbacks or array methods.
**Tags**: [basic](./level/basic), [lambda expressions](./theme/lambda_expressions), [arrow functions](./theme/arrow_functions), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446080608989678880](https://www.tiktok.com/@jsmentoring/photo/7446080608989678880)
---
### What is the difference between == and === operators?
In JavaScript, `==` is the equality operator that compares values after performing type coercion, meaning it converts the values to a common type before comparing them. On the other hand, `===` is the strict equality operator, which compares both the value and the type without any type conversion.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446055928723508512](https://www.tiktok.com/@jsmentoring/photo/7446055928723508512)
---
### What is the purpose of the array splice method?
The `splice()` method in JavaScript is used to modify an array by adding, removing, or replacing elements. It takes at least two arguments: the index at which to start changing the array, and the number of elements to remove. Additional arguments can be provided to add new elements.
**Tags**: [basic](./level/basic), [splice](./theme/splice), [array](./theme/array), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446035575565520160](https://www.tiktok.com/@jsmentoring/photo/7446035575565520160)
---
### What is the difference between slice and splice?
`slice()` is used to extract a shallow copy of a portion of an array without modifying the original array, while `splice()` is used to change the contents of an array by removing or replacing elements. The key difference is that `slice()` does not alter the array, while `splice()` does.
**Tags**: [basic](./level/basic), [slice](./theme/slice), [splice](./theme/splice), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7446029933446565152](https://www.tiktok.com/@jsmentoring/photo/7446029933446565152)
---
### 5 Ways to Create Objects in JavaScript
In JavaScript, objects can be created in various ways. The five most common methods are:
1. **Object Literal**: `const obj = {}`
2. **Object Constructor**: `const obj = new Object()`
3. **Object.create()**: `const obj = Object.create(null)`
4. **Class Syntax**: `class MyClass { constructor() {} }`
5. **Factory Functions**: `function createObject() { return {}}`
**Tags**: [basic](./level/basic), [objects](./theme/objects), [creation](./theme/creation), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7445448146685136161](https://www.tiktok.com/@jsmentoring/photo/7445448146685136161)
---
### What is git rebase command?
The `git rebase` command is used to integrate changes from one branch into another. It works by moving or 'replaying' commits from one branch onto another, creating a linear history. This is different from `git merge`, which creates a merge commit. `git rebase` can be used to keep a cleaner, more linear commit history.
**Tags**: [basic](./level/basic), [git](./theme/git), [rebase](./theme/rebase), [version control](./theme/version_control)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7444874869394771232](https://www.tiktok.com/@jsmentoring/photo/7444874869394771232)
---
### What is git reflog command?
The `git reflog` command is used to show the history of changes to the reference logs, which track updates to the branches in a repository. This can be useful for recovering lost commits or understanding the changes made to a branch, especially after actions like rebasing or resetting.
**Tags**: [basic](./level/basic), [git](./theme/git), [reflog](./theme/reflog), [version control](./theme/version_control)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7444873101717884192](https://www.tiktok.com/@jsmentoring/photo/7444873101717884192)
---
### What is git revert command?
The `git revert` command is used to create a new commit that undoes the changes made by a previous commit. Unlike `git reset`, which alters the commit history, `git revert` preserves the commit history and is often used in shared repositories to undo changes safely.
**Tags**: [basic](./level/basic), [git](./theme/git), [revert](./theme/revert), [version control](./theme/version_control)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7444867368431439136](https://www.tiktok.com/@jsmentoring/photo/7444867368431439136)
---
### What is a storage event and its event handler?
A storage event is triggered when a change is made to the `localStorage` or `sessionStorage` in the browser, such as adding, removing, or modifying a key-value pair. The event handler for this event allows you to respond to these changes, providing a way to synchronize or react to storage updates across different windows or tabs.
**Tags**: [intermediate](./level/intermediate), [storage event](./theme/storage_event), [event handler](./theme/event_handler), [web storage](./theme/web_storage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448353911720742177](https://www.tiktok.com/@jsmentoring/photo/7448353911720742177)
---
### What are the methods available on session storage?
`sessionStorage` provides methods to interact with the browser's session storage. Key methods include:
- `setItem(key, value)`: Adds a key-value pair.
- `getItem(key)`: Retrieves the value for a given key.
- `removeItem(key)`: Removes the key-value pair.
- `clear()`: Clears all data stored in sessionStorage.
**Tags**: [basic](./level/basic), [sessionStorage](./theme/sessionstorage), [web storage](./theme/web_storage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448368128825888032](https://www.tiktok.com/@jsmentoring/photo/7448368128825888032)
---
### How do you access web storage?
Web storage is accessed using the `localStorage` or `sessionStorage` objects in JavaScript. For example, you can use `localStorage.setItem('key', 'value')` to store data, and `localStorage.getItem('key')` to retrieve it. Both `localStorage` and `sessionStorage` are part of the Window interface and provide a simple API for storing key-value pairs.
**Tags**: [basic](./level/basic), [web storage](./theme/web_storage), [sessionStorage](./theme/sessionstorage), [localStorage](./theme/localstorage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448375078183587105](https://www.tiktok.com/@jsmentoring/photo/7448375078183587105)
---
### What is the main difference between localStorage and sessionStorage?
The main difference is the lifespan of the stored data:
- **`localStorage`** persists data even after the browser is closed, and the data remains available until explicitly removed.
- **`sessionStorage`** only stores data for the duration of the page session. Once the tab or window is closed, the data is cleared.
**Tags**: [basic](./level/basic), [localStorage](./theme/localstorage), [sessionStorage](./theme/sessionstorage), [web storage](./theme/web_storage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448379916778851617](https://www.tiktok.com/@jsmentoring/photo/7448379916778851617)
---
### Why do you need a Cookie?
Cookies are used to store data on the client-side, typically for purposes like tracking user sessions, saving preferences, or authenticating users. They are sent to the server with every HTTP request, allowing the server to remember information about the client across requests and sessions.
**Tags**: [intermediate](./level/intermediate), [cookies](./theme/cookies), [web storage](./theme/web_storage), [HTTP](./theme/http)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448385477113171233](https://www.tiktok.com/@jsmentoring/photo/7448385477113171233)
---
### What is a Cookie?
A cookie is a small piece of data stored by the browser on the client-side. It is sent to the server with every HTTP request and is used for various purposes such as maintaining user sessions, tracking user activity, and storing preferences.
**Tags**: [basic](./level/basic), [cookies](./theme/cookies), [web storage](./theme/web_storage), [HTTP](./theme/http)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448395347279236384](https://www.tiktok.com/@jsmentoring/photo/7448395347279236384)
---
### What is web storage?
Web storage provides a way to store data in the browser. It includes two types: `localStorage` and `sessionStorage`. `localStorage` stores data persistently, while `sessionStorage` stores data for the duration of a session, which is cleared when the browser or tab is closed.
**Tags**: [basic](./level/basic), [web storage](./theme/web_storage), [localStorage](./theme/localstorage), [sessionStorage](./theme/sessionstorage)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448401312728878368](https://www.tiktok.com/@jsmentoring/photo/7448401312728878368)
---
### What Are Server-Sent Events (SSE)?
Server-Sent Events (SSE) is a technology that allows a server to push updates to the client over a single HTTP connection. This is typically used for real-time applications such as notifications, live scores, or chat apps, where the server sends updates to the client automatically.
**Tags**: [intermediate](./level/intermediate), [SSE](./theme/sse), [real-time communication](./theme/real_time_communication), [web technologies](./theme/web_technologies)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448434434774142240](https://www.tiktok.com/@jsmentoring/photo/7448434434774142240)
---
### What Is a Callback Hell?
Callback hell, also known as 'Pyramid of Doom,' refers to a situation where multiple nested callback functions in JavaScript make the code hard to read and maintain. It usually occurs in asynchronous code and can be mitigated by using Promises or async/await.
**Tags**: [intermediate](./level/intermediate), [callback hell](./theme/callback_hell), [asynchronous](./theme/asynchronous), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448549870673169696](https://www.tiktok.com/@jsmentoring/photo/7448549870673169696)
---
### Importance of Callbacks in Javascript?
Callbacks in JavaScript are functions passed as arguments to other functions, enabling asynchronous programming. They allow for non-blocking code execution, making it possible to handle events like user input or network requests without freezing the application.
**Tags**: [basic](./level/basic), [callbacks](./theme/callbacks), [JavaScript](./theme/javascript), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448582345390591265](https://www.tiktok.com/@jsmentoring/photo/7448582345390591265)
---
### What is a callback function in javascript?
A callback function is a function passed into another function as an argument and executed after the completion of a task. Callbacks are commonly used in asynchronous programming, such as handling events or making HTTP requests.
**Tags**: [basic](./level/basic), [callback function](./theme/callback_function), [JavaScript](./theme/javascript), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448614606278282529](https://www.tiktok.com/@jsmentoring/photo/7448614606278282529)
---
### What Are the Three States of a Promise?
A Promise in JavaScript can be in one of three states:
- **Pending**: The initial state, neither fulfilled nor rejected.
- **Fulfilled**: The operation completed successfully.
- **Rejected**: The operation failed.
**Tags**: [intermediate](./level/intermediate), [Promise](./theme/promise), [JavaScript](./theme/javascript), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448655823150058785](https://www.tiktok.com/@jsmentoring/photo/7448655823150058785)
---
### Why do you need a promise?
Promises are used to handle asynchronous operations in JavaScript. They provide a cleaner way to handle asynchronous code, avoiding callback hell by chaining `.then()` and `.catch()` methods to handle success and failure, respectively.
**Tags**: [intermediate](./level/intermediate), [Promise](./theme/promise), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448671709634235681](https://www.tiktok.com/@jsmentoring/photo/7448671709634235681)
---
### What is a promise?
A promise is an object in JavaScript that represents the eventual completion (or failure) of an asynchronous operation and its resulting value. It allows you to attach `.then()` and `.catch()` methods to handle the results or errors of the asynchronous task.
**Tags**: [intermediate](./level/intermediate), [Promise](./theme/promise), [JavaScript](./theme/javascript), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448715825642540320](https://www.tiktok.com/@jsmentoring/photo/7448715825642540320)
---
### What are the restrictions of web workers on DOM?
Web workers run in a separate thread and cannot directly access or modify the DOM. They are designed for heavy computations and background tasks. To interact with the DOM, workers communicate with the main thread using message passing via `postMessage()`.
**Tags**: [advanced](./level/advanced), [web workers](./theme/web_workers), [DOM](./theme/dom), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448725365574372641](https://www.tiktok.com/@jsmentoring/photo/7448725365574372641)
---
### Give an example of a web worker?
A simple web worker example:
```javascript
const worker = new Worker('worker.js');
worker.postMessage('Hello');
worker.onmessage = function(event) {
console.log('Received from worker:', event.data);
};
```
In the `worker.js` file, you would handle the message with `onmessage` and use `postMessage` to send a response back.
**Tags**: [intermediate](./level/intermediate), [web workers](./theme/web_workers), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448739040213437729](https://www.tiktok.com/@jsmentoring/photo/7448739040213437729)
---
### How do you check web storage browser support?
To check if a browser supports web storage, you can check if `localStorage` or `sessionStorage` is available:
```javascript
if (typeof(Storage) !== 'undefined') {
// Web storage is supported
} else {
// Web storage is not supported
}
```
**Tags**: [basic](./level/basic), [web storage](./theme/web_storage), [browser support](./theme/browser_support), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448750198848769313](https://www.tiktok.com/@jsmentoring/photo/7448750198848769313)
---
### Why do you need web storage?
Web storage allows you to store data on the client side, providing faster access to information without requiring a round-trip to the server. It helps with tasks like saving user preferences, session information, and caching data for offline use.
**Tags**: [basic](./level/basic), [web storage](./theme/web_storage), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448934582965046561](https://www.tiktok.com/@jsmentoring/photo/7448934582965046561)
---
### How Do You Receive Server-Sent Event Notifications?
To receive Server-Sent Event (SSE) notifications, you need to create an `EventSource` object in JavaScript, which listens for events sent by the server. For example:
```javascript
const eventSource = new EventSource('https://example.com/sse');
eventSource.onmessage = function(event) {
console.log('New message:', event.data);
};
```
**Tags**: [intermediate](./level/intermediate), [Server-Sent Events](./theme/server_sent_events), [notifications](./theme/notifications), [web technologies](./theme/web_technologies)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7448989685881376033](https://www.tiktok.com/@jsmentoring/photo/7448989685881376033)
---
### What Is a Callback in Callback?
A 'callback in callback' refers to a situation where a function is passed as a parameter to another function, and that function in turn calls another function (callback) within it. This can lead to nested callbacks, which may result in 'callback hell' if not managed properly.
**Tags**: [intermediate](./level/intermediate), [callbacks](./theme/callbacks), [asynchronous programming](./theme/asynchronous_programming), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449011382449720608](https://www.tiktok.com/@jsmentoring/photo/7449011382449720608)
---
### What Is Promise Chaining in JavaScript?
Promise chaining allows you to chain multiple `.then()` calls to handle sequential asynchronous operations. Each `.then()` returns a new promise, enabling the next step in the chain to execute after the previous one is fulfilled.
```javascript
fetchData()
.then(result => processData(result))
.then(processedData => displayData(processedData))
.catch(error => console.error(error));
```
**Tags**: [intermediate](./level/intermediate), [Promises](./theme/promises), [JavaScript](./theme/javascript), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449040289345457441](https://www.tiktok.com/@jsmentoring/photo/7449040289345457441)
---
### What Are the Main Rules of Promise in JavaScript?
The main rules of Promises in JavaScript are:
1. A promise can be in one of three states: pending, fulfilled, or rejected.
2. A promise can only transition from pending to fulfilled or rejected, and cannot change back.
3. You can attach `.then()` to handle success and `.catch()` for errors.
**Tags**: [intermediate](./level/intermediate), [Promises](./theme/promises), [JavaScript](./theme/javascript)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449057432086580513](https://www.tiktok.com/@jsmentoring/photo/7449057432086580513)
---
### What Are the Events Available for Server-Sent Events?
Server-Sent Events (SSE) support several event types, including:
- `message`: The default event for incoming data.
- `open`: Fired when the connection to the server is established.
- `error`: Fired when there is an error with the connection.
**Tags**: [intermediate](./level/intermediate), [Server-Sent Events](./theme/server_sent_events), [web technologies](./theme/web_technologies)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449065499603881248](https://www.tiktok.com/@jsmentoring/photo/7449065499603881248)
---
### How Do You Check Browser Support for Server-Sent Events?
To check if the browser supports Server-Sent Events, you can check for the `EventSource` object:
```javascript
if (typeof(EventSource) !== 'undefined') {
// SSE is supported
} else {
// SSE is not supported
}
```
**Tags**: [basic](./level/basic), [Server-Sent Events](./theme/server_sent_events), [browser support](./theme/browser_support)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449149383142018336](https://www.tiktok.com/@jsmentoring/photo/7449149383142018336)
---
### What Is `Promise.all` in JavaScript?
`Promise.all` is a method that accepts an array of promises and returns a single promise that resolves when all the promises in the array are resolved. If any of the promises reject, the returned promise will reject immediately.
```javascript
Promise.all([promise1, promise2, promise3])
.then(results => console.log(results))
.catch(error => console.error(error));
```
**Tags**: [intermediate](./level/intermediate), [Promises](./theme/promises), [JavaScript](./theme/javascript), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449321820743847200](https://www.tiktok.com/@jsmentoring/photo/7449321820743847200)
---
### What Is the Purpose of the `race` Method in Promises?
The `Promise.race()` method returns a promise that resolves or rejects as soon as one of the promises in the iterable resolves or rejects. It is useful when you need to wait for the first promise to settle.
```javascript
Promise.race([promise1, promise2, promise3])
.then(result => console.log(result))
.catch(error => console.error(error));
```
**Tags**: [intermediate](./level/intermediate), [Promises](./theme/promises), [JavaScript](./theme/javascript), [asynchronous programming](./theme/asynchronous_programming)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449363438461144353](https://www.tiktok.com/@jsmentoring/photo/7449363438461144353)
---
### What Is Strict Mode in JavaScript?
Strict mode is a way to opt in to a restricted version of JavaScript. It helps catch common coding mistakes and prevents the use of certain features that can lead to bugs, such as using undeclared variables.
```javascript
'use strict';
var x = 3.14; // Error in strict mode: assignment to undeclared variable
```
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [strict mode](./theme/strict_mode)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449392707455175968](https://www.tiktok.com/@jsmentoring/photo/7449392707455175968)
---
### What Is the Purpose of Double Exclamation in JavaScript?
Double exclamation (`!!`) is used to convert a value into a boolean. The first exclamation negates the value, and the second negates it again, resulting in a boolean representation of the value.
```javascript
console.log(!!'string'); // true
console.log(!!0); // false
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [type coercion](./theme/type_coercion)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449429710985022753](https://www.tiktok.com/@jsmentoring/photo/7449429710985022753)
---
### How Do You Declare Strict Mode in JavaScript?
To declare strict mode in JavaScript, simply add `'use strict';` at the beginning of a script or a function.
```javascript
'use strict';
// Code here will be executed in strict mode
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [strict mode](./theme/strict_mode)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449490448533507361](https://www.tiktok.com/@jsmentoring/photo/7449490448533507361)
---
### How Do You Detect Caps Lock Key Turned On or Not?
To detect whether Caps Lock is on, you can use the `keydown` or `keypress` event and check the `event.getModifierState('CapsLock')` property.
```javascript
document.addEventListener('keydown', function(event) {
if (event.getModifierState('CapsLock')) {
console.log('Caps Lock is on');
}
});
```
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [event handling](./theme/event_handling), [keyboard events](./theme/keyboard_events)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449671849920761120](https://www.tiktok.com/@jsmentoring/photo/7449671849920761120)
---
### How Do You Access History in JavaScript?
You can access the browser history using the `window.history` object. This allows you to manipulate the session history (navigate, go back, forward, etc.).
```javascript
window.history.back(); // Go back to the previous page
window.history.forward(); // Go forward in history
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [history API](./theme/history_api)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449732288268487969](https://www.tiktok.com/@jsmentoring/photo/7449732288268487969)
---
### What Is the Difference Between `window` and `document` in JavaScript?
`window` represents the browser window and is the global object in the browser's JavaScript environment. `document`, on the other hand, represents the HTML document loaded in the browser, allowing interaction with the DOM.
```javascript
console.log(window); // Browser window
console.log(document); // HTML document
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [DOM](./theme/dom)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449755076182215968](https://www.tiktok.com/@jsmentoring/photo/7449755076182215968)
---
### What Is the Purpose of Double Exclamation in JavaScript?
Double exclamation (`!!`) is used to convert a value to a boolean. The first negation converts it to a boolean, and the second negation reverts it to the correct boolean value.
```javascript
console.log(!!'text'); // true
console.log(!!null); // false
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [type coercion](./theme/type_coercion)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449813378895203617](https://www.tiktok.com/@jsmentoring/photo/7449813378895203617)
---
### What Is `eval` in JavaScript?
`eval()` is a JavaScript function that evaluates a string of JavaScript code. It is generally discouraged due to security risks such as code injection vulnerabilities.
```javascript
eval('console.log("Hello, World!")'); // Logs 'Hello, World!'
```
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [security](./theme/security)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449833381975559446](https://www.tiktok.com/@jsmentoring/photo/7449833381975559446)
---
### What Is the `null` Value in JavaScript?
`null` is a primitive value that represents the intentional absence of any object value. It is used to indicate that a variable is empty or uninitialized.
```javascript
let x = null;
console.log(x); // null
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [data types](./theme/data_types)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7449876086793489696](https://www.tiktok.com/@jsmentoring/photo/7449876086793489696)
---
### What Is the `undefined` Property in JavaScript?
`undefined` is a primitive value that is automatically assigned to variables that are declared but not initialized. It represents the absence of a defined value.
```javascript
let x;
console.log(x); // undefined
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [data types](./theme/data_types)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7450179747931278624](https://www.tiktok.com/@jsmentoring/photo/7450179747931278624)
---
### What Is the Purpose of the `delete` Operator in JavaScript?
The `delete` operator is used to remove a property from an object or an element from an array.
```javascript
let obj = { name: 'John', age: 30 };
delete obj.age;
console.log(obj); // { name: 'John' }
```
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [operators](./theme/operators)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7450258222222560544](https://www.tiktok.com/@jsmentoring/photo/7450258222222560544)
---
### What Is the `typeof` Operator in JavaScript?
The `typeof` operator returns a string indicating the type of the unevaluated operand. It is commonly used to check the type of variables or expressions.
```javascript
console.log(typeof 'Hello'); // string
console.log(typeof 123); // number
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [operators](./theme/operators)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7450568773712497953](https://www.tiktok.com/@jsmentoring/photo/7450568773712497953)
---
### What Is `isNaN` in JavaScript?
`isNaN()` is a function that checks whether a value is NaN (Not-a-Number). It returns `true` if the value is NaN, and `false` otherwise.
```javascript
console.log(isNaN(123)); // false
console.log(isNaN('Hello')); // true
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [type checking](./theme/type_checking)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7450774214459673888](https://www.tiktok.com/@jsmentoring/photo/7450774214459673888)
---
### What are the differences between undeclared and undefined variables?
An undeclared variable is one that has not been declared using `var`, `let`, or `const`. An undefined variable is one that has been declared but not assigned a value.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [variables](./theme/variables)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7450925531370884385](https://www.tiktok.com/@jsmentoring/photo/7450925531370884385)
---
### What are global variables?
Global variables are variables that are declared outside of any function and are accessible from any part of the code.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [variables](./theme/variables)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7450838618257575201](https://www.tiktok.com/@jsmentoring/photo/7450838618257575201)
---
### What are the problems with global variables?
Global variables can cause issues like name collisions, difficulty in debugging, and unintended side effects. It's recommended to limit the use of global variables.
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [best practices](./theme/best_practices)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7451163740982070561](https://www.tiktok.com/@jsmentoring/photo/7451163740982070561)
---
### What is NaN property?
`NaN` (Not-a-Number) is a special value in JavaScript that represents an invalid or undefined numerical result, such as the result of dividing 0 by 0.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [type checking](./theme/type_checking)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7451255958266760480](https://www.tiktok.com/@jsmentoring/photo/7451255958266760480)
---
### What is the purpose of isFinite function?
`isFinite()` is used to check if a value is a finite number. It returns `true` if the value is a finite number, and `false` otherwise.
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [type checking](./theme/type_checking)
---
### What is an event flow?
Event flow in JavaScript refers to the order in which events are propagated through the DOM. It consists of three phases: capturing phase, target phase, and bubbling phase.
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [events](./theme/events)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7451321489682468128](https://www.tiktok.com/@jsmentoring/photo/7451321489682468128)
---
### What is event bubbling?
Event bubbling is the process where an event triggered on a child element is propagated up to its parent elements. It is the default behavior for most events in JavaScript.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [events](./theme/events)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7451597511862603040](https://www.tiktok.com/@jsmentoring/photo/7451597511862603040)
---
### Can I add getters and setters using defineProperty method?
Yes, you can add getters and setters using `Object.defineProperty()`. This allows you to define custom getter and setter methods for specific properties.
Example:
```javascript
const person = {};
Object.defineProperty(person, 'name', {
get() { return this._name; },
set(value) { this._name = value.toUpperCase(); }
});
person.name = 'John';
console.log(person.name); // 'JOHN'
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [objects](./theme/objects)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7459755921485434144](https://www.tiktok.com/@jsmentoring/photo/7459755921485434144)
---
### Can I avoid using postMessages completely?
While `postMessage` is a useful API for cross-origin communication, alternatives like `localStorage`, `cookies`, or server-side messaging (e.g., WebSockets) can be used depending on the use case. Avoiding `postMessage` may increase security in certain scenarios.
**Tags**: [advanced](./level/advanced), [JavaScript](./theme/javascript), [Security](./theme/security)
---
### Can I redeclare `let` and `const` variables?
No, you cannot redeclare `let` and `const` variables in the same scope. The `let` and `const` declarations are block-scoped, and attempting to redeclare them will result in a syntax error.
Example:
```javascript
let x = 10;
let x = 20; // Error: Cannot redeclare block-scoped variable 'x'
```
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [Variables](./theme/variables)
---
### Can I use reserved words as identifiers?
No, you cannot use reserved words (such as `let`, `class`, `function`, etc.) as identifiers (variable names, function names, etc.) in JavaScript.
Example:
```javascript
let let = 5; // SyntaxError: Unexpected token 'let'
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [syntax](./theme/syntax)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7457212868161850657](https://www.tiktok.com/@jsmentoring/photo/7457212868161850657)
---
### Can we define properties for functions?
Yes, functions in JavaScript are objects, so you can define properties for them.
```javascript
function myFunc() {}
myFunc.property = 'value';
console.log(myFunc.property); // 'value'
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [functions](./theme/functions)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7456170349391023393](https://www.tiktok.com/@jsmentoring/photo/7456170349391023393)
---
### Can you apply chaining on conditional operator?
Yes, you can chain multiple conditional operators together to evaluate multiple conditions in a single expression.
Example:
```javascript
const result = (age >= 18) ? 'Adult' : (age >= 13) ? 'Teen' : 'Child';
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [operators](./theme/operators)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7458016862446570785](https://www.tiktok.com/@jsmentoring/photo/7458016862446570785)
---
### Can you give an example of when you really need a semicolon?
Semicolons are generally optional in JavaScript, but there are situations where they are required. For example, when returning an object from a function on the same line.
Example:
```javascript
return { key: 'value' }; // Requires semicolon
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [syntax](./theme/syntax)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7457679188732939553](https://www.tiktok.com/@jsmentoring/photo/7457679188732939553)
---
### Can you write a random integers function to print integers within a range?
You can create a function that generates random integers within a specified range.
Example:
```javascript
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
console.log(getRandomInt(1, 100)); // Generates a random integer between 1 and 100
```
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [math](./theme/math)
**URL**: [https://www.tiktok.com/@jsmentoring/photo/7456920292397518112](https://www.tiktok.com/@jsmentoring/photo/7456920292397518112)
---
### Check for Anagrams
An anagram is a word or phrase formed by rearranging the letters of another, using all the original letters exactly once.
#### Algorithm:
1. Remove any non-alphanumeric characters and convert both strings to lowercase.
2. Check if the lengths of the two strings are the same. If not, they cannot be anagrams.
3. Count the frequency of each character in the first string.
4. Compare the character counts with the second string by decrementing the counts. If any count becomes negative or mismatches, the strings are not anagrams.
#### Example:
```javascript
function areAnagrams(str1, str2) {
// Normalize the strings: remove non-alphanumeric characters and convert to lowercase
const normalize = str => str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
const s1 = normalize(str1);
const s2 = normalize(str2);
if (s1.length !== s2.length) {
return false; // Different lengths mean they can't be anagrams
}
const charCount = {};
// Count characters in the first string
for (const char of s1) {
charCount[char] = (charCount[char] || 0) + 1;
}
// Compare characters with the second string
for (const char of s2) {
if (!charCount[char]) {
return false; // Character mismatch
}
charCount[char]--;
}
return true; // Strings are anagrams
}
// Example usage
console.log(areAnagrams("listen", "silent")); // Output: true
console.log(areAnagrams("hello", "world")); // Output: false
```
This method has a time complexity of O(n), where n is the length of the strings.
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [Strings](./theme/strings), [Algorithm](./theme/algorithm)
**URL**: [https://www.tiktok.com/@jsmentoring/video/7458386392272473377](https://www.tiktok.com/@jsmentoring/video/7458386392272473377)
---
### Check if a Number is Perfect
A perfect number is a positive integer that is equal to the sum of its proper divisors (excluding the number itself).
#### Algorithm:
1. Initialize a variable to store the sum of divisors.
2. Iterate from 1 to half of the number.
3. For each divisor, add it to the sum.
4. If the sum equals the original number, return `true`, otherwise return `false`.
#### Example:
```javascript
function isPerfectNumber(num) {
let sum = 0;
for (let i = 1; i <= num / 2; i++) {
if (num % i === 0) sum += i;
}
return sum === num;
}
// Example usage
console.log(isPerfectNumber(28)); // Output: true
console.log(isPerfectNumber(6)); // Output: true
console.log(isPerfectNumber(10)); // Output: false
```
This method has a time complexity of O(n), where n is the number being checked.
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [Math](./theme/math), [Algorithm](./theme/algorithm)
---
### Check if a Number is Prime
To check if a number is prime, verify that it is greater than 1 and divisible only by 1 and itself.
#### Algorithm:
1. Check if the number is less than or equal to 1; if so, return false.
2. Iterate through numbers from 2 to the square root of the number.
3. If the number is divisible by any of these, return false.
4. If no divisors are found, return true.
#### Example:
```javascript
function isPrime(num) {
if (num <= 1) {
return false;
}
for (let i = 2; i <= Math.sqrt(num); i++) {
if (num % i === 0) {
return false;
}
}
return true;
}
// Example usage
console.log(isPrime(7)); // Output: true
console.log(isPrime(10)); // Output: false
```
This method has a time complexity of O(sqrt(n)), where n is the number being checked.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [Numbers](./theme/numbers), [Algorithm](./theme/algorithm)
---
### Check if a String is a Palindrome
A palindrome is a word, phrase, or sequence that reads the same backward as forward.
#### Algorithm:
1. Remove all non-alphanumeric characters and convert the string to lowercase to handle case sensitivity.
2. Use two pointers: one starting at the beginning and the other at the end of the string.
3. Compare characters at the two pointers. If they differ, the string is not a palindrome.
4. Move the pointers closer to the center and repeat the comparison.
5. If all characters match, the string is a palindrome.
#### Example:
```javascript
function isPalindrome(str) {
// Normalize the string: remove non-alphanumeric characters and convert to lowercase
const cleanStr = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
let left = 0;
let right = cleanStr.length - 1;
while (left < right) {
if (cleanStr[left] !== cleanStr[right]) {
return false; // Not a palindrome
}
left++;
right--;
}
return true; // It's a palindrome
}
// Example usage
console.log(isPalindrome("A man, a plan, a canal, Panama")); // Output: true
console.log(isPalindrome("hello")); // Output: false
```
This method has a time complexity of O(n), where n is the length of the string.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [Strings](./theme/strings), [Algorithm](./theme/algorithm)
**URL**: [https://www.tiktok.com/@jsmentoring/video/7458413373315681569](https://www.tiktok.com/@jsmentoring/video/7458413373315681569)
---
### Check if a String is a Palindromic Permutation
To check if a string is a permutation of a palindrome, the string's characters must appear in pairs (except possibly one character for odd-length strings).
#### Algorithm:
1. Count the frequency of each character in the string.
2. Check how many characters have an odd frequency.
3. If more than one character has an odd frequency, return false; otherwise, return true.
#### Example:
```javascript
function isPalindromicPermutation(str) {
const freqMap = {};
for (const char of str) {
freqMap[char] = (freqMap[char] || 0) + 1;
}
let oddCount = 0;
for (const count of Object.values(freqMap)) {
if (count % 2 !== 0) {
oddCount += 1;
}
}
return oddCount <= 1;
}
// Example usage
console.log(isPalindromicPermutation("civic")); // Output: true
console.log(isPalindromicPermutation("ivicc")); // Output: true
console.log(isPalindromicPermutation("hello")); // Output: false
```
This method has a time complexity of O(n), where n is the length of the string.
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [Strings](./theme/strings), [Algorithm](./theme/algorithm)
---
### Check if a String is Rotated
To check if one string is a rotation of another, concatenate the first string with itself and check if the second string is a substring of the result.
#### Algorithm:
1. Concatenate the first string with itself.
2. Check if the second string is a substring of the concatenated string.
3. If it is, return `true`; otherwise, return `false`.
#### Example:
```javascript
function isRotated(str1, str2) {
if (str1.length !== str2.length) return false;
return (str1 + str1).includes(str2);
}
// Example usage
console.log(isRotated('abcde', 'cdeab')); // Output: true
console.log(isRotated('abcde', 'abced')); // Output: false
```
This method has a time complexity of O(n), where n is the length of the strings.
**Tags**: [intermediate](./level/intermediate), [JavaScript](./theme/javascript), [Strings](./theme/strings), [Algorithm](./theme/algorithm)
---
### Check if an Array is Sorted
To check if an array is sorted, compare each element with the next one to ensure it is in the correct order.
#### Algorithm:
1. Iterate through the array and compare each element with the next.
2. If any element is greater than the next one, the array is not sorted.
3. If no such element is found, return true; otherwise, return false.
#### Example:
```javascript
function isArraySorted(arr) {
for (let i = 0; i < arr.length - 1; i++) {
if (arr[i] > arr[i + 1]) {
return false;
}
}
return true;
}
// Example usage
console.log(isArraySorted([1, 2, 3, 4])); // Output: true
console.log(isArraySorted([1, 3, 2, 4])); // Output: false
```
This method has a time complexity of O(n), where n is the length of the array.
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [Arrays](./theme/arrays), [Algorithm](./theme/algorithm)
---
### Check if Two Strings Are Palindromes of Each Other
To check if two strings are palindromes of each other, reverse one string and compare it with the other string.
#### Algorithm:
1. Reverse one of the strings.
2. Compare the reversed string with the other string.
3. If they are equal, return true, indicating that they are palindromes of each other.
#### Example:
```javascript
function arePalindromes(str1, str2) {
return str1 === str2.split('').reverse().join('');
}
// Example usage
console.log(arePalindromes('abcd', 'dcba')); // Output: true
console.log(arePalindromes('abc', 'def')); // O