InterviewHubPRO
HomeTracksSection 8: JavaScript Internals (521 Qs)
Section 8 of 13521 Questions (1 Per Page)

Core JavaScript Master: Prototypes, Closures, Event Loop, ES6+ & Web APIs

The definitive 521 JavaScript interview questions covering Object prototypes, closures, event loop, Promises, ES6-ES2024, Web APIs, DOM, and performance.

Curriculum Roadmap & Learning Path

8 Stages
Tip: Click any stage card above to instantly filter the question bank to that topic.8 Connected Milestones

Part 1: Core Objects, Prototypes, Functions & Scope (1 - 53)

53 Questions
1

What is JavaScript, and what are its core architectural characteristics?

2

What are the primitive and reference data types in JavaScript, and how are they stored in memory?

3

What is the difference between JavaScript and ECMAScript?

4

What are the possible ways to create objects in JavaScript

5

What is a prototype chain

6

What is the Difference Between call, apply, and bind

7

What is JSON and its common operations

8

What is the purpose of the array slice method

9

What is the purpose of the array splice method

10

What is the difference between slice and splice

11

How do you compare Object and Map

12

What is the difference between == and === operators

13

What are lambda expressions or arrow functions

14

What is a first class function

15

What is a first order function

16

What is a higher order function

17

What is a unary function

18

What is the currying function

19

What is a pure function

20

What are the benefits of pure functions

21

What is the purpose of the let keyword

22

What is the difference between let and var

23

What is the reason to choose the name let as a keyword

24

How do you redeclare variables in a switch block without an error

25

What is the Temporal Dead Zone

26

What is an IIFE (Immediately Invoked Function Expression)

27

How do you decode or encode a URL in JavaScript?

28

What is memoization

29

What is Hoisting

30

What are classes in ES6

31

What are closures

32

What are modules

33

Why do you need modules

34

What is scope in javascript

35

What is a service worker

36

How do you manipulate DOM using a service worker

37

How do you reuse information across service worker restarts

38

What is IndexedDB

39

What is web storage

40

What is a post message

41

What is a Cookie

42

Why do you need a Cookie

43

What are the options in a cookie

44

How do you delete a cookie

45

What are the differences between cookie, local storage and session storage

46

What is the main difference between localStorage and sessionStorage

47

How do you access web storage

48

What are the methods available on session storage

49

What is a storage event and its event handler

50

Why do you need web storage

51

How do you check web storage browser support

52

How do you check web workers browser support

53

Give an example of a web worker

Part 2: Promises, Callbacks, Async & Strict Mode (54 - 103)

50 Questions
54

What are the restrictions of web workers on DOM

55

What is a promise

56

Why do you need a promise

57

Explain the three states of promise

58

What is a callback function

59

Why do we need callbacks

60

What is a callback hell

61

What are server-sent events

62

How do you receive server-sent event notifications

63

How do you check browser support for server-sent events

64

What are the events available for server sent events

65

What are the main rules of promise

66

What is callback in callback

67

What is promise chaining

68

What is promise.all

69

Does Promise.all() cancel the other Promises?

70

What is the purpose of the race method in promise

71

What is a strict mode in javascript

72

Why do you need strict mode

73

How do you declare strict mode

74

What is the purpose of double exclamation

75

What is the purpose of the delete operator

76

What is typeof operator

77

What is undefined property

78

What is null value

79

What is the difference between null and undefined

80

What is eval

81

What is the difference between window and document

82

How do you access history in javascript

83

How do you detect caps lock key turned on or not

84

What is isNaN

85

What are the differences between undeclared and undefined variables

86

What are global variables

87

What are the problems with global variables

88

What is NaN property

89

What is the purpose of isFinite function

90

What is an event flow

91

What is event capturing

92

What is event bubbling

93

How do you submit a form using JavaScript

94

How do you find operating system details

95

What is the difference between document load and DOMContentLoaded events

96

What is the difference between native, host and user objects

97

What are the tools or techniques used for debugging JavaScript code

98

What are the pros and cons of promises over callbacks

99

What is the difference between an attribute and a property

100

What is same-origin policy

101

What is the purpose of void 0

102

Is JavaScript a compiled or interpreted language

103

Is JavaScript a case-sensitive language

Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

70 Questions
104

Is there any relation between Java and JavaScript

105

What are events

106

Who created javascript

107

What is the use of preventDefault method

108

What is the use of stopPropagation method

109

What are the steps involved in return false usage

110

What is BOM

111

What is the use of setTimeout

112

What is the use of setInterval

113

Why is JavaScript treated as Single threaded

114

What is an event delegation

115

What is ECMAScript

116

What is JSON

117

What are the syntax rules of JSON

118

What is the purpose JSON stringify

119

How do you parse JSON string

120

Why do you need JSON

121

What are PWAs

122

What is the purpose of clearTimeout method

123

What is the purpose of clearInterval method

124

How do you redirect new page in javascript

125

How do you check whether a string contains a substring

126

How do you validate an email in javascript

127

How do you get the current url with javascript

128

What are the various url properties of location object

129

How do you get query string values in javascript

130

How do you check if a key exists in an object

131

How do you loop through or enumerate javascript object

132

How do you test for an empty object

133

What is an arguments object

134

How do you make first letter of the string in an uppercase

135

What are the pros and cons of for loops

136

How do you display the current date in javascript

137

How do you compare two date objects

138

How do you check if a string starts with another string

139

How do you trim a string in javascript

140

How do you add a key value pair in javascript

141

Is the !-- notation represents a special operator

142

How do you assign default values to variables

143

How do you define multiline strings

144

What is an app shell model

145

Can we define properties for functions

146

What is the way to find the number of parameters expected by a function

147

What is a polyfill

148

What are break and continue statements

149

What are js labels

150

What are the benefits of keeping declarations at the top

151

What are the benefits of initializing variables

152

What are the recommendations to create new object

153

How do you define JSON arrays

154

How do you generate random integers

155

Can you write a random integers function to print integers within a range

156

What is tree shaking

157

What is the need of tree shaking

158

Is it recommended to use eval

159

What is a Regular Expression

160

What are the string methods that accept Regular expression

161

What are modifiers in regular expression

162

What are regular expression patterns

163

What is a RegExp object

164

How do you search a string for a pattern

165

What is the purpose of exec method

166

How do you change the style of a HTML element

167

What would be the result of 1+2+'3'

168

What is a debugger statement

169

What is the purpose of breakpoints in debugging

170

Can I use reserved words as identifiers

171

How do you detect a mobile browser

172

How do you detect a mobile browser without regexp

173

How do you get the image width and height using JS

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

80 Questions
174

How do you make synchronous HTTP request

175

How do you make asynchronous HTTP request

176

How do you convert date to another timezone in javascript

177

What are the properties used to get size of window

178

What is a conditional operator in javascript

179

Can you apply chaining on conditional operator

180

What are the ways to execute javascript after a page load

181

What is the difference between proto and prototype

182

Can you give an example of when you really need a semicolon

183

What is the freeze method

184

What is the purpose of the freeze method

185

Why do I need to use the freeze method

186

How do you detect a browser language preference

187

How to convert a string to title case with javascript

188

How do you detect if javascript is disabled on the page

189

What are various operators supported by javascript

190

What is a rest parameter

191

What happens if you do not use rest parameter as a last argument

192

What are the bitwise operators available in javascript

193

What is a spread operator

194

How do you determine whether object is frozen or not

195

How do you determine two values same or not using object

196

What is the purpose of using object is method

197

How do you copy properties from one object to other

198

What are the applications of the assign method

199

What is a proxy object

200

What is the purpose of the seal method

201

What are the applications of the seal method

202

What are the differences between the freeze and seal methods

203

How do you determine if an object is sealed or not

204

How do you get enumerable key and value pairs

205

What is the main difference between Object.values and Object.entries method

206

How can you get the list of keys of any object

207

How do you create an object with a prototype

208

What is a WeakSet

209

What are the differences between WeakSet and Set

210

List down the collection of methods available on WeakSet

211

What is a WeakMap

212

What are the differences between WeakMap and Map

213

List down the collection of methods available on WeakMap

214

What is the purpose of uneval

215

How do you encode an URL

216

How do you decode an URL

217

How do you print the contents of web page

218

What is the difference between uneval and eval

219

What is an anonymous function

220

What is the precedence order between local and global variables

221

What are javascript accessors

222

How do you define property on Object constructor

223

What is the difference between get and defineProperty

224

What are the advantages of Getters and Setters

225

Can I add getters and setters using defineProperty method

226

What is the purpose of switch-case

227

What are the conventions to be followed for the usage of switch case

228

What are primitive data types

229

What are the different ways to access object properties

230

What are the function parameter rules

231

What is an error object

232

When do you get a syntax error

233

What are the different error names from error object

234

What are the various statements in error handling

235

What are the two types of loops in javascript

236

What is nodejs

237

What is the Intl object

238

How do you perform language specific date and time formatting

239

What is an Iterator

240

How does synchronous iteration works

241

What is the event loop

242

What is the call stack

243

What is the event queue

244

What is a decorator

245

What are the properties of the Intl object

246

What is an Unary operator

247

How do you sort elements in an array

248

What is the purpose of compareFunction while sorting arrays

249

How do you reverse an array

250

How do you find the min and max values in an array

251

How do you find the min and max values without Math functions

252

What is an empty statement and purpose of it

253

How do you get the metadata of a module

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

75 Questions
254

What is the comma operator

255

What is the advantage of the comma operator

256

What is typescript

257

What are the differences between javascript and typescript

258

What are the advantages of typescript over javascript

259

What is an object initializer

260

What is a constructor method

261

What happens if you write constructor more than once in a class

262

How do you call the constructor of a parent class

263

How do you get the prototype of an object

264

What happens If I pass string type for getPrototype method

265

How do you set the prototype of one object to another

266

How do you check whether an object can be extended or not

267

How do you prevent an object from being extend

268

What are the different ways to make an object non-extensible

269

How do you define multiple properties on an object

270

What is the MEAN stack

271

What is obfuscation in javascript

272

Why do you need Obfuscation

273

What is Minification

274

What are the advantages of minification

275

What are the differences between obfuscation and Encryption

276

What are the common tools used for minification

277

How do you perform form validation using javascript

278

How do you perform form validation without javascript

279

What are the DOM methods available for constraint validation

280

What are the available constraint validation DOM properties

281

What are the validity properties

282

Give an example usage of the rangeOverflow property

283

Are enums available in javascript

284

What is an enum

285

How do you list all properties of an object

286

How do you get property descriptors of an object

287

What are the attributes provided by a property descriptor

288

How do you extend classes

289

How do I modify the url without reloading the page

290

How do you check whether or not an array includes a particular value

291

How do you compare scalar arrays

292

How to get the value from get parameters

293

How do you print numbers with commas as thousand separators

294

What is the difference between java and javascript

295

Does JavaScript support namespaces

296

How do you declare a namespace

297

How do you invoke javascript code in an iframe from the parent page

298

How do you get the timezone offset of a date object

299

How do you load CSS and JS files dynamically

300

What are the different methods to find HTML elements in DOM

301

What is jQuery

302

What is V8 JavaScript engine

303

Why do we call javascript as dynamic language

304

What is a void operator

305

How to set the cursor to wait

306

How do you create an infinite loop

307

Why do you need to avoid with statement

308

What is the output of the following for loops

309

List down some of the features of ES6

310

What is ES6

311

Can I redeclare let and const variables

312

Does the const variable make the value immutable

313

What are default parameters

314

What are template literals

315

How do you write multi-line strings in template literals

316

What are nesting templates

317

What are tagged templates

318

What are raw strings

319

What is destructuring assignment

320

What are default values in destructuring assignment

321

How do you swap variables in destructuring assignment

322

What are enhanced object literals

323

What are dynamic imports

324

What are the use cases for dynamic imports

325

What are typed arrays

326

What are the advantages of module loaders

327

What is collation

328

What is for...of statement

Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

75 Questions
329

What is the output of below spread operator array

330

Is PostMessage secure

331

What are the problems with postmessage target origin as wildcard

332

How do you avoid receiving postMessages from attackers

333

Can I avoid using postMessages completely

334

Is postMessages synchronous

335

What paradigm is Javascript

336

What is the difference between internal and external javascript

337

Is JavaScript faster than server side script

338

How do you get the status of a checkbox

339

What is the purpose of double tilde operator

340

How do you convert character to ASCII code

341

What is ArrayBuffer

342

What is the output of below string expression

343

What is the purpose of Error object

344

What is the purpose of EvalError object

345

What are the list of cases error thrown from non-strict mode to strict mode

346

Do all objects have prototypes

347

What is the difference between a parameter and an argument

348

What is the purpose of some method in arrays

349

How do you combine two or more arrays

350

What is the difference between Shallow and Deep copy

351

How do you create specific number of copies of a string

352

How do you return all matching strings against a regular expression

353

How do you trim a string at the beginning or ending

354

What is the output of below console statement with unary operator

355

Does javascript uses mixins

356

Mixin Example using Object composition

357

Benefits

358

What is a thunk function

359

What are asynchronous thunks

360

What is the output of below function calls

361

How to remove all line breaks from a string

362

What is the difference between reflow and repaint

363

What happens with negating an array

364

What happens if we add two arrays

365

What is the output of prepend additive operator on falsy values

366

How do you create self string using special characters

367

How do you remove falsy values from an array

368

How do you get unique values of an array

369

What is destructuring aliases

370

How do you map the array values without using map method

371

How do you empty an array

372

How do you round numbers to certain decimals

373

What is the easiest way to convert an array to an object

374

How do you create an array with some data

375

What are the placeholders from console object

376

Is it possible to add CSS to console messages

377

What is the purpose of dir method of console object

378

Is it possible to debug HTML elements in console

379

How do you display data in a tabular format using console object

380

How do you verify that an argument is a Number or not

381

How do you create copy to clipboard button

382

What is the shortcut to get timestamp

383

How do you flattening multi dimensional arrays

384

What is the easiest multi condition checking

385

How do you capture browser back button

386

How do you disable right click in the web page

387

What are wrapper objects

388

What is AJAX

389

What are the different ways to deal with Asynchronous Code

390

How to cancel a fetch request

391

What is web speech API

392

What is minimum timeout throttling

393

How do you implement zero timeout in modern browsers

394

What are tasks in event loop

395

What is microtask

396

What are different event loops

397

What is the purpose of queueMicrotask

398

How do you use javascript libraries in typescript file

399

What are the differences between promises and observables

400

What is heap

401

What is an event table

402

What is a microTask queue

403

What is the difference between shim and polyfill

Part 7: Execution Context, Functional JS & V8 Engine (404 - 463)

60 Questions
404

How do you detect primitive or non primitive value type

405

What is babel

406

Is Node.js completely single threaded

407

What are the common use cases of observables

408

What is RxJS

409

What is the difference between Function constructor and function declaration

410

What is a Short circuit condition

411

What is the easiest way to resize an array

412

What is an observable

413

What is the difference between function and class declarations

414

What is an async function

415

How do you prevent promises swallowing errors

416

What is deno

417

How do you make an object iterable in javascript

418

What is a Proper Tail Call

419

How do you check an object is a promise or not

420

How to detect if a function is called as constructor

421

What are the differences between arguments object and rest parameter

422

What are the differences between spread operator and rest parameter

423

What are the different kinds of generators

424

What are the built-in iterables

425

What are the differences between for...of and for...in statements

426

How do you define instance and non-instance properties

427

What is the difference between isNaN and Number.isNaN?

428

How to invoke an IIFE without any extra brackets?

429

Is that possible to use expressions in switch cases?

430

What is the easiest way to ignore promise errors?

431

How do style the console output using CSS?

432

What is nullish coalescing operator (??)?

433

How do you group and nest console output?

434

What is the difference between dense and sparse arrays?

435

What are the different ways to create sparse arrays?

436

What is the difference between setTimeout, setImmediate and process.nextTick?

437

How do you reverse an array without modifying original array?

438

How do you create custom HTML element?

439

What is global execution context?

440

What is function execution context?

441

What is debouncing?

442

What is throttling?

443

What is optional chaining?

444

What is an environment record?

445

How to verify if a variable is an array?

446

What is pass by value and pass by reference?

447

What are the differences between primitives and non-primitives?

448

How do you create your own bind method using either call or apply method?

449

What are the differences between pure and impure functions?

450

What is referential transparency?

451

What are the possible side-effects in javascript?

452

What are compose and pipe functions?

453

What is module pattern?

454

What is Function Composition?

455

How to use await outside of async function prior to ES2022?

456

What is the purpose of the this keyword in JavaScript?

457

What are the uses of closures?

458

What are the phases of execution context?

459

What are the possible reasons for memory leaks?

460

What are the optimization techniques of V8 engine?

461

What are the examples of built-in higher order functions?

462

What are the benefits higher order functions?

463

How do you create polyfills for map, filter and reduce methods?

Part 8: Modern JavaScript APIs, WeakRef, Proxy & Performance (464 - 521)

58 Questions
464

What is the difference between map and forEach functions?

465

Give an example of statements affected by automatic semicolon insertion?

466

What are the event phases of a browser?

467

What are the real world use cases of proxy?

468

What are hidden classes?

469

What is inline caching?

470

What are the different ways to execute external scripts?

471

What is Lexical Scope?

472

How to detect system dark mode in javascript?

473

What is the purpose of requestAnimationFrame method?

474

What is the difference between substring and substr methods?

475

How to find the number of parameters expected by a function?

476

What is globalThis, and what is the importance of it?

477

What are the array mutation methods?

478

What is module scope in JavaScript?

479

What are shadowing and illegal shadowing?

480

Why is it important to remove event listeners after use?

481

What is structuredClone and how is it used for deep copying objects?

482

What is the difference between const and Object.freeze

483

What is Promise.any and when should it be used?

484

What is BigInt and how is it different from Number?

485

What are private class fields in JavaScript?

486

What is the Array.prototype.at() method and why is it useful?

487

What is top-level await in JavaScript modules?

488

What are WeakRef and FinalizationRegistry used for?

489

What are logical assignment operators?

490

What is the Temporal API and why is it proposed as a replacement for Date?

491

What is the difference between for loop and forEach

492

What are Symbols and what are their use cases?

493

What is the difference between Object.create() and Object.assign()?

494

What are generator functions and how do they work?

495

What is the Reflect API and when should you use it?

496

How does JavaScript handle floating point precision issues?

497

What are tagged template literals and their practical uses?

498

What is the difference between Object.keys(), Object.values(), and Object.entries()?

499

What is the Intl.NumberFormat API and how is it used?

500

How do you implement method chaining in JavaScript?

501

What are the differences between Map and Object for storing key-value pairs?

502

What is the purpose of Symbol.iterator and how do you use it?

503

How does the Intersection Observer API work?

504

What are async iterators and how are they different from regular iterators?

505

What is the purpose of Object.getOwnPropertyDescriptors()?

506

How does Promise.allSettled() differ from Promise.all()?

507

What are the performance implications of using try-catch in JavaScript?

508

What is the AbortController API and how is it used?

509

How do you implement a custom error class in JavaScript?

510

What is the difference between synchronous and asynchronous generators?

511

What are Proxy traps and what operations can they intercept?

512

How does the Mutation Observer API work?

513

What is tail call optimization and does JavaScript support it?

514

What are the different ways to handle circular references in JSON?

515

How do you implement a singleton pattern in JavaScript?

516

What is the Performance API and how is it used for measuring performance?

517

What are the differences between SharedArrayBuffer and ArrayBuffer?

518

How do you prevent prototype pollution attacks in JavaScript?

519

What is the Atomics API and when should it be used?

520

How do you implement a lazy loading pattern for modules?

521

What are the best practices for optimizing JavaScript bundle size?