Random Qs on Javascript

  • data types in JS -> difference between Primitives and Complex
  • Math.max() // -Infinity (Why )
  • Type Co-Ersion + Shadowing
  • How to check object is an array in JavaScript?
  • How to check object is an object (& array or functions)?
  • How to return multiple values in JS ?
  • when to use IIFE (3 use cases of IIFE)
  • How to achieve Immutability on JS data types.

→ Object.assign(), concat, filter, map, reduce

  • how to get last element of an array (# using arr[arr.length-1]);

→ is there any inbuilt function to find the last element of an array. ( # NO)

→ OK…then WAF (such as arr.last) which will give the last element of an array. ( # define using prototypes);

  • calculator.one().three().five().value() => 1+3+5 => 9
  • sum of two numbers via Regular function
  • sum(2,3,4,5,6); # using Spread Operator + reduce
  • sum([2,3,4,5,6]); # using Recursion
  • sum(4)(5)(9)(88); # Curried function + recursion
  • sum of no. of an array using Recursion.
  • Pure Functions ← is Math.random() pure ?→
  • Pure Components in React
  • (4) ways of creating an Object
  • dot notation vs square bracket notation []
  • for vs forEach() vs map() vs for…in vs for…of
  • Classes in ES5 (constructor + new ) vs Classes in ES6
  • What is a Static method in Classes.
  • Properties of OOP (A,E,I,P)
  • Private properties in JS
  • Memory Leaks

➤ Asynchronous JS

  • why callbacks ? inbuilt example of callback (setTimeout)
  • how to write custom Callback
  • Callbacks, Promises, Async-await (all when dealing with asynchronousity)
  • difference between Promises and async-await
  • cases where promises still scores over async-await
  • axios() vs fetch()

  • Currying, Chaining in JS (as in jQuery)
  • Pure Function, no side effects
  • Functions as first-class objects
  • ES6 features
  • Hoisting, Scoping (global, local)
  • Closures (what, why, how) and disadvantages of using Closures.
  • Memory Leaks in JS
  • which function is executed, if JS has multiple functions with the same name ? (over-riding vs over-loading)
  • how to over-ride built in JS alert() function.
  • Promise.allSettled() vs Promise.race() vs Promise.all()
  • web developers challenges faced.
  • Object.create() vs new()
  • What name is given to when a function is passed to another function?
  • Lambda ( anonymous function)
  • difference between JS array and arrays in other programming languages ?
  • slice(), splice() , split() methods in JS.
  • web worker vs service worker
  • repaint vs reflow in CRP (critical rendering path)
  • bubbling, capturing, event delegation

Qs. For Senior / Manager / Architect level

Ⓠ. WAF to increment a counter on each pageLoad (not possible via react) =>

JavaScript and local storage @ https://code-maven.com/on-load-counter-with-javascript-and-local-storage

❗in how many ways (3) can you create GLOBAL SCOPE in JS?

❗ Same project..which one will you choose (React /Angular / View)

❗weird features of JS which sets it apart from other programming languages.

Ⓠ. Can we replace regular functions all over with arrow functions. If NOT, where we cannot ?

Hint: NO, remember the difference between Regular & Arrow functions.

❗Does let and const support hosting + Temporary dead zone

❗variable shadowing

❗Event loop

❗Currying + Chaining

❗Prototypes vs __proto__

❗Critical rendering path

❗Debounce vs throttling

❗ Async /await over promises & callbacks

❗Shallow compare vs deep compare

❗4 methods of Objects creation and difference

❗ Inheritance in ES5 vs inheritance in ES6

❗ CSR vs server side rendering

❗Progressive Web App (PWA)

React For Senior / Manager / Architect level

❗How will you pass (same) data (as prop) from two siblings component…i.e., two components at the same level.

❗When to use Pure components ….give an example

❗ What are the ways to re-render a component.

-> change state, change props, or force render()

❗Which is the (only) life cycle available on both CSR & SSR.

-> componentWillMount

❗In which all life cycles, setState is NOT allowed ?

Experience with Front-end Technologies and MERN / MEAN Stack. Working on all Major UI Frameworks like React, Angular.