JavaScript Core & ES6+

1. Operators & Equality

Q: What is the difference between == and ===?
Think about type coercion.
Basic Implementation
console.log(5 == "5");  // true (Coercion)
console.log(5 === "5"); // false (Strict)
Real World Example (Lodash)
// From Lodash .eq source
function eq(value, other) {
  return value === other || (value !== value && other !== other);
}
// Uses strict equality but handles NaN (value !== value)
Show Answer

== (Loose Equality): Performs type coercion before comparing. 5 == "5" is true.

=== (Strict Equality): Checks both value and type. 5 === "5" is false.

Senior Note: Always use ===. The only exception might be checking for null/undefined simultaneously with if (x == null), but even then, explicit checks are preferred.

Q: Explain Short-Circuit Evaluation (&&, ||, ??)
How does React use this for conditional rendering?
Basic Implementation
const name = user.name || "Guest"; // Fallback
const age = user.age ?? 18; // Nullish check
Real World Example (React)
return (
  <div>
    {isLoggedIn && <UserProfile />}
    {errorMessage || <DefaultMessage />}
  </div>
);
Show Answer

Used heavily in React for conditional rendering.

// AND (&&): Returns first falsy or last truthy
const show = true && "Display Me"; // "Display Me"

// OR (||): Returns first truthy
const name = inputName || "Default"; // "Default" if inputName is ""

// Nullish Coalescing (??): Returns right side ONLY if left is null/undefined
const count = 0 ?? 10; // 0 (because 0 is not null)
const count2 = 0 || 10; // 10 (because 0 is falsy)

2. ES6+ Features

Q: What is the difference between var, let, and const?
Scope and Hoisting.
Basic Implementation
let count = 1;
count = 2; // OK

const pi = 3.14;
pi = 3; // TypeError: Assignment to constant variable.
Real World Example (React State)
// 'state' is const because we don't reassign it directly.
// We use the setter function to trigger updates.
const [state, setState] = useState(0);
Show Answer
  • var: Function scoped. Hoisted. Can be re-declared. (Avoid using).
  • let: Block scoped. Not hoisted (TDZ). Can be re-assigned.
  • const: Block scoped. Cannot be re-assigned (but objects can be mutated).
const user = { name: "A" };
user.name = "B"; // Allowed (Mutation)
user = { name: "C" }; // Error (Re-assignment)
Q: Explain Closures with a practical example.
Function inside a function.
Basic Implementation
function outer() {
  let x = 10;
  return () => x; // Remembers x
}
const getX = outer();
console.log(getX()); // 10
Real World Example (React useEffect)
useEffect(() => {
  const timer = setInterval(() => {
    console.log(count); // Closure captures 'count'
  }, 1000);
  return () => clearInterval(timer);
}, [count]); // Dependency array updates the closure
Show Answer

A closure is a function that remembers the variables from the scope where it was defined, even after that scope has closed.

function createCounter() {
  let count = 0; // Private variable
  return function() {
    count++;
    return count;
  };
}

const counter = createCounter();
console.log(counter()); // 1
console.log(counter()); // 2
// 'count' is inaccessible from outside
Q: What is "Hoisting"?
Moving to the top.
Basic Implementation
console.log(x); // undefined (var is hoisted)
var x = 5;

console.log(y); // ReferenceError (let is in TDZ)
let y = 10;
Real World Example (Component Structure)
// Function declarations are hoisted, allowing top-down reading
export default function App() {
  return <Helper />;
}

function Helper() { // Defined below, used above
  return <div>Helper</div>;
}
Show Answer

JavaScript's behavior of moving declarations to the top of the scope. var and function declarations are hoisted. let and const are hoisted but stay in the "Temporal Dead Zone" (TDZ) until initialized.

Q: What is the Event Loop?
Call Stack, Web APIs, Callback Queue.
Basic Implementation
console.log(1);
setTimeout(() => console.log(2), 0); // Macrotask
Promise.resolve().then(() => console.log(3)); // Microtask
console.log(4);
// Output: 1, 4, 3, 2
Real World Example (Non-blocking UI)
// Deferring heavy calculation to avoid freezing UI
function handleHeavyTask() {
  setTimeout(() => {
    heavyCalculation(); // Runs in next tick
  }, 0);
}
Show Answer

JS is single-threaded. The Event Loop checks if the Call Stack is empty. If yes, it moves items from the Callback Queue (Macrotasks) or Microtask Queue (Promises) to the Call Stack to be executed.

Q: What is `this` keyword?
Context of execution.
Basic Implementation
const obj = {
  name: 'Me',
  say: function() { console.log(this.name) },
  arrow: () => console.log(this.name)
};
obj.say(); // 'Me'
obj.arrow(); // undefined (inherits global/window)
Real World Example (Class Components)
class Button extends React.Component {
  handleClick = () => {
    // Arrow function auto-binds 'this' to the instance
    console.log(this.props.label);
  }
}
Show Answer

It refers to the object that is executing the current function. In an arrow function, `this` is lexically scoped (inherited from parent). In a regular function, it depends on how the function is called.

Q: What is "Prototypal Inheritance"?
Objects linking to objects.
Basic Implementation
const animal = { eats: true };
const rabbit = Object.create(animal);
console.log(rabbit.eats); // true (inherited)
Real World Example (Polyfills)
if (!Array.prototype.includes) {
  Array.prototype.includes = function(item) {
    // Add method to all Arrays via prototype
    return this.indexOf(item) !== -1;
  };
}
Show Answer

Objects in JS have a hidden property `[[Prototype]]`. If you access a property that doesn't exist on the object, JS looks up the prototype chain until it finds it or hits null.

Q: What is "Currying"?
f(a, b) -> f(a)(b)
Basic Implementation
const add = a => b => a + b;
add(1)(2); // 3
Real World Example (Redux Middleware)
const logger = store => next => action => {
  console.log('dispatching', action);
  return next(action);
};
Show Answer

Transforming a function that takes multiple arguments into a sequence of functions that each take a single argument. Useful for partial application.

3. Async Logic

Q: Promises vs. Async/Await
Syntactic sugar.
Basic Implementation
// Promise
fetch(url).then(r => r.json()).then(d => console.log(d));

// Async/Await
const res = await fetch(url);
const data = await res.json();
Real World Example (React Effect)
useEffect(() => {
  async function load() {
    try {
      const data = await api.get();
      setData(data);
    } catch (e) { setError(e); }
  }
  load();
}, []);
Show Answer

Async/Await is syntactic sugar over Promises. It makes async code look synchronous.

// Promise Chain
fetch('/api')
  .then(res => res.json())
  .then(data => console.log(data))
  .catch(err => console.error(err));

// Async/Await (Cleaner)
async function getData() {
  try {
    const res = await fetch('/api');
    const data = await res.json();
    console.log(data);
  } catch (err) {
    console.error(err);
  }
}

4. Functions & Scope

Q: What is the difference between Function Declaration and Function Expression?
Hoisting.
Basic Implementation
// Declaration (Hoisted)
function add(a, b) { return a + b; }

// Expression (Not Hoisted)
const sub = function(a, b) { return a - b; };
Real World Example (React Components)
// Named export (Declaration)
export function Button() {}

// Default export (Expression often used)
const Card = () => {};
export default Card;
Show Answer

Declarations are hoisted (can be called before definition). Expressions are not (must be defined before use).

Q: What is an IIFE?
Immediately Invoked...
Basic Implementation
(function() {
  const privateVar = "secret";
})();
// privateVar is not accessible here
Real World Example (useEffect Async)
useEffect(() => {
  // IIFE to run async code in useEffect
  (async () => {
    await fetchData();
  })();
}, []);
Show Answer

Immediately Invoked Function Expression. Used to create a private scope and avoid polluting the global namespace.

(function() {
  // Private code
})();
Q: Arrow Functions vs Regular Functions (`this`)
Lexical vs Dynamic scoping.
Basic Implementation
function Regular() { this.val = 1; }
const Arrow = () => { this.val = 1; }; // Error if used as constructor
Real World Example (Event Handlers)
// Regular function needs binding in classes
this.handleClick = this.handleClick.bind(this);

// Arrow function inherits 'this' automatically
handleClick = () => { this.setState(...) };
Show Answer

Arrow functions do not have their own `this`; they inherit it from the parent scope. Regular functions have a dynamic `this` depending on how they are called.

Q: What is "Callback Hell"?
Pyramid of Doom.
Basic Implementation
getData(a => {
  getMore(a, b => {
    getFinal(b, c => {
      console.log(c);
    });
  });
});
Real World Example (Solution)
// Flattened with Async/Await
const a = await getData();
const b = await getMore(a);
const c = await getFinal(b);
Show Answer

Deeply nested callbacks that make code hard to read and debug. Solved by Promises and Async/Await.

Q: What is the difference between `call`, `apply`, and `bind`?
Invoking vs Returning.
Basic Implementation
function greet(lang) { console.log(lang, this.name); }
const user = { name: 'Dev' };

greet.call(user, 'JS'); // "JS Dev"
greet.apply(user, ['JS']); // "JS Dev"
const newFn = greet.bind(user); newFn('JS');
Real World Example (Borrowing Methods)
// Borrowing Array methods for arguments object
const args = Array.prototype.slice.call(arguments);
Show Answer
  • call(thisArg, arg1, arg2): Invokes function immediately.
  • apply(thisArg, [args]): Invokes immediately, takes array of args.
  • bind(thisArg): Returns a new function with `this` bound.

5. Objects & Arrays

Q: Deep Copy vs Shallow Copy
References vs Values.
Basic Implementation
const original = { a: { b: 1 } };
const shallow = { ...original }; // shallow.a === original.a
const deep = JSON.parse(JSON.stringify(original)); // New object
Real World Example (Redux Reducers)
// Must return new object references for updates
return {
  ...state,
  nested: { ...state.nested, value: 1 }
};
Show Answer

Shallow: Copies top-level properties. Nested objects are still references. ({...obj}, Object.assign).

Deep: Copies all levels. (JSON.parse(JSON.stringify(obj)) or structuredClone(obj)).

Q: `map` vs `forEach`
Return value.
Basic Implementation
const arr = [1, 2, 3];
const doubled = arr.map(x => x * 2); // [2, 4, 6]
arr.forEach(x => console.log(x)); // Returns undefined
Real World Example (React Rendering)
// map is used to transform data into elements
{items.map(item => (
  <li key={item.id}>{item.name}</li>
))}
Show Answer

map returns a new array. forEach returns undefined (used for side effects).

Q: Explain `reduce`
Accumulator.
Basic Implementation
const nums = [1, 2, 3, 4];
const sum = nums.reduce((acc, curr) => acc + curr, 0); // 10
Real World Example (Data Transformation)
// Convert array to object map
const userMap = users.reduce((acc, user) => {
  acc[user.id] = user;
  return acc;
}, {});
Show Answer

Transforms an array into a single value (number, object, another array) by applying a function to an accumulator and each element.

Q: `filter` vs `find`
Array vs Item.
Basic Implementation
const nums = [1, 2, 3, 4];
const evens = nums.filter(n => n % 2 === 0); // [2, 4]
const firstEven = nums.find(n => n % 2 === 0); // 2
Real World Example (Search)
// Filter for search results
const results = items.filter(i => i.name.includes(query));
// Find for specific item selection
const selected = items.find(i => i.id === selectedId);
Show Answer

filter returns an array of all matching elements. find returns the first matching element (or undefined).

Q: Mutability methods in Arrays
Which ones change the original array?
Basic Implementation
const arr = [3, 1, 2];
arr.sort(); // Mutates arr to [1, 2, 3]
const sorted = arr.toSorted(); // New array (ES2023)
Real World Example (State Updates)
// Avoid mutation in React
// Bad: state.push(item)
// Good:
setState([...state, item]);
Show Answer

Mutating: push, pop, shift, unshift, splice, sort, reverse.

Non-Mutating: map, filter, reduce, slice, concat, toSorted (ES2023).

Q: Object.freeze vs const
Variable vs Value.
Basic Implementation
const obj = { x: 1 };
obj.x = 2; // Allowed
Object.freeze(obj);
obj.x = 3; // Error in strict mode
Real World Example (Config)
const CONFIG = Object.freeze({
  API_URL: 'https://api.example.com',
  TIMEOUT: 5000
});
Show Answer

const prevents reassignment of the variable identifier. Object.freeze prevents modification of the object's properties.

Q: Optional Chaining (`?.`)
Safe access.
Basic Implementation
const street = user?.address?.street;
// Equivalent to:
// user && user.address && user.address.street
Real World Example (API Response)
// Handling incomplete data
const avatar = data?.user?.profile?.avatarUrl || defaultAvatar;
Show Answer

Allows reading the value of a property located deep within a chain of connected objects without having to expressly validate that each reference in the chain is valid. user?.address?.street.

Q: Destructuring Assignment
Unpacking.
Basic Implementation
const [first, second] = [10, 20];
const { name, age } = { name: 'A', age: 25 };
Real World Example (Props)
function UserCard({ name, email, ...rest }) {
  return <div {...rest}>{name} ({email})</div>;
}
Show Answer

Extracting values from arrays or properties from objects into distinct variables. const { name } = user;.

Q: Spread vs Rest Operator (`...`)
Expanding vs Collecting.
Basic Implementation
// Spread
const combined = [...arr1, ...arr2];
// Rest
function sum(...args) { return args.reduce((a,b)=>a+b); }
Real World Example (State Updates)
setUser(prev => ({
  ...prev, // Spread existing properties
  name: 'New Name' // Overwrite one
}));
Show Answer

Spread: Expands an iterable into elements. [...arr].

Rest: Collects multiple elements into an array. function(...args) {}.

Q: `Set` vs `Map`
Unique values vs Key-Value pairs.
Basic Implementation
const unique = new Set([1, 1, 2]); // {1, 2}
const map = new Map();
map.set(keyObj, "value");
Real World Example (Deduplication)
const uniqueTags = [...new Set(allTags)];
Show Answer

Set: Collection of unique values.

Map: Collection of key-value pairs where keys can be any type (objects, functions), unlike Objects where keys are strings/symbols.

6. DOM & Web APIs

Q: Event Bubbling vs Capturing
Up vs Down.
Basic Implementation
// Bubbling (Default): Child -> Parent
// Capturing: Parent -> Child
element.addEventListener('click', handler, { capture: true });
Real World Example (Analytics)
// Capture all clicks on the page for tracking
document.addEventListener('click', (e) => {
  trackClick(e.target);
}, true); // Use capture to ensure it runs before stopPropagation
Show Answer

Bubbling: Event starts at target and goes up to window (default).

Capturing: Event goes down from window to target.

Q: Event Delegation
One listener for many.
Basic Implementation
document.getElementById('list').addEventListener('click', (e) => {
  if (e.target.tagName === 'LI') {
    console.log('Clicked item:', e.target.textContent);
  }
});
Real World Example (Dynamic Lists)
// React uses delegation automatically at the root.
// But in vanilla JS, this saves memory for large lists.
const table = document.querySelector('table');
table.onclick = function(event) {
  let target = event.target.closest('td');
  if (!target) return;
  highlight(target);
};
Show Answer

Attaching a single event listener to a parent element to manage events for all its children (using bubbling). Efficient for dynamic lists.

Q: `preventDefault` vs `stopPropagation`
Browser action vs Bubble.
Basic Implementation
form.onsubmit = (e) => {
  e.preventDefault(); // Stop reload
  e.stopPropagation(); // Stop bubbling to parent
};
Real World Example (Modal)
// Prevent closing modal when clicking inside content
<div onClick={closeModal}>
  <div onClick={e => e.stopPropagation()}>
    Content
  </div>
</div>
Show Answer

preventDefault: Stops the browser's default behavior (e.g., form submission).

stopPropagation: Stops the event from bubbling up the DOM.

Q: LocalStorage vs SessionStorage vs Cookies
Persistence and Scope.
Basic Implementation
localStorage.setItem('theme', 'dark'); // Forever
sessionStorage.setItem('tabData', '123'); // Tab life
document.cookie = "user=John; max-age=3600"; // Server sent
Real World Example (Auth Token)
// HttpOnly Cookie is best for security (XSS protection)
// LocalStorage is okay for non-sensitive preferences
const theme = localStorage.getItem('theme') || 'light';
Show Answer
  • LocalStorage: Persists until cleared. 5MB. Client-side only.
  • SessionStorage: Persists until tab closed. 5MB.
  • Cookies: Sent with every HTTP request. 4KB. Can have expiration.

7. Advanced & Performance

Q: Debounce vs Throttle
Delay vs Rate Limit.
Basic Implementation
// Debounce: Search input
const debouncedSearch = debounce((text) => api.search(text), 300);

// Throttle: Scroll event
const throttledScroll = throttle(() => checkPosition(), 100);
Real World Example (Lodash)
import { debounce } from 'lodash';
// Prevent API spam on every keystroke
<input onChange={e => debouncedSearch(e.target.value)} />
Show Answer

Debounce: Wait for a pause in events before running (e.g., Search input).

Throttle: Run at most once every X ms (e.g., Scroll event).

Q: Garbage Collection
Mark and Sweep.
Basic Implementation
let user = { name: "John" };
user = null; // Object is now unreachable -> GC collects it
Real World Example (Memory Leak)
// Detached DOM nodes
let detached = document.createElement('div');
// If we keep a reference to 'detached' in a global array,
// it will never be collected even if not in DOM.
Show Answer

JS engine automatically frees memory. "Mark and Sweep" algorithm marks reachable objects and sweeps (deletes) unreachable ones.

Q: Memory Leaks
Unwanted references.
Basic Implementation
// Forgotten Timer
setInterval(() => {
  // This runs forever if not cleared
}, 1000);
Real World Example (React Cleanup)
useEffect(() => {
  const sub = api.subscribe();
  // FORGETTING THIS causes leak on unmount:
  return () => sub.unsubscribe();
}, []);
Show Answer

Common causes: Global variables, Uncleared intervals/timeouts, Event listeners not removed, Closures holding references.

Q: CommonJS vs ES Modules
require vs import.
Basic Implementation
// CJS
const fs = require('fs');
module.exports = fn;

// ESM
import fs from 'fs';
export default fn;
Real World Example (Tree Shaking)
// ESM allows bundlers to remove unused code
import { Button } from 'library'; // Only bundles Button
Show Answer

CommonJS: Node.js default. require/module.exports. Synchronous.

ESM: Browser standard. import/export. Asynchronous/Static analysis.

Q: Generator Functions
function* and yield.
Basic Implementation
function* idMaker() {
  let index = 0;
  while(true) yield index++;
}
const gen = idMaker();
console.log(gen.next().value); // 0
Real World Example (Redux Saga)
function* fetchUser(action) {
  try {
    const user = yield call(Api.fetchUser, action.payload.userId);
    yield put({type: "USER_FETCH_SUCCEEDED", user: user});
  } catch (e) {
    yield put({type: "USER_FETCH_FAILED", message: e.message});
  }
}
Show Answer

Functions that can be paused and resumed. Used in Redux-Saga.

Q: WeakMap vs Map
Garbage collection.
Basic Implementation
let obj = { id: 1 };
const weakMap = new WeakMap();
weakMap.set(obj, "metadata");
obj = null; // Entry in weakMap is automatically removed
Real World Example (Private Data)
const privateData = new WeakMap();
class User {
  constructor(name) {
    privateData.set(this, { secret: '123' });
  }
}
Show Answer

WeakMap keys must be objects and are weakly held, meaning they don't prevent garbage collection if the object is not used elsewhere.

Q: `NaN`
Not a Number.
Basic Implementation
console.log(Number("abc")); // NaN
console.log(NaN === NaN); // false
Real World Example (Validation)
function safeDivide(a, b) {
  const res = a / b;
  if (Number.isNaN(res)) return 0;
  return res;
}
Show Answer

Result of invalid math. typeof NaN === 'number'. NaN !== NaN (Use Number.isNaN()).

Q: `null` vs `undefined`
Intentional vs Unintentional.
Basic Implementation
let a; // undefined
let b = null; // null
Real World Example (API Design)
// undefined: Field missing from JSON
// null: Field exists but has no value
{ "name": "John", "middleName": null }
Show Answer

undefined: Variable declared but not assigned.

null: Intentional absence of value.

Q: Implicit Coercion
1 + "2"
Basic Implementation
console.log(1 + "2"); // "12"
console.log("5" - 1); // 4
console.log([] + []); // ""
Real World Example (Bugs)
// API returns string "100"
const total = price + tax; // "10010" if not parsed!
const safeTotal = Number(price) + Number(tax);
Show Answer

Automatic conversion of values. 1 + "2" = "12". "5" - 1 = 4.

Q: Strict Mode
"use strict"
Basic Implementation
"use strict";
x = 3.14; // ReferenceError (x is not defined)
Real World Example (Modules)
// ES Modules are strict by default.
// You don't need to add "use strict" in React/Vite projects.
Show Answer

Enforces stricter parsing and error handling. Prevents using undeclared variables, duplicate parameter names, etc.

Q: `try...catch...finally`
Error handling.
Basic Implementation
try {
  throw new Error("Oops");
} catch (e) {
  console.error(e);
} finally {
  console.log("Cleanup");
}
Real World Example (Loading State)
setLoading(true);
try {
  await fetchData();
} catch (e) {
  setError(e);
} finally {
  setLoading(false); // Runs even if error occurs
}
Show Answer

finally block executes regardless of whether an error occurred or not. Useful for cleanup.

Q: Custom Errors
Extending Error.
Basic Implementation
class AuthError extends Error {
  constructor(msg) {
    super(msg);
    this.name = "AuthError";
  }
}
Real World Example (API Handling)
if (response.status === 401) {
  throw new AuthError("Session expired");
}
// Catch block can check: if (e instanceof AuthError) ...
Show Answer
class ValidationError extends Error {
  constructor(message) {
    super(message);
    this.name = "ValidationError";
  }
}
Q: `Symbol`
Unique identifier.
Basic Implementation
const sym1 = Symbol('foo');
const sym2 = Symbol('foo');
console.log(sym1 === sym2); // false
Real World Example (Hidden Properties)
const ID = Symbol('id');
user[ID] = 123; // Not visible in for...in loops or JSON.stringify
Show Answer

A primitive data type that is guaranteed to be unique. Often used for object property keys to avoid collisions.

Q: Iterator Protocol
next()
Basic Implementation
const myIter = {
  [Symbol.iterator]() {
    let n = 0;
    return {
      next() { return { value: n++, done: n > 3 } }
    };
  }
};
for (const n of myIter) console.log(n); // 0, 1, 2
Real World Example (Custom Collections)
// Making a custom LinkedList iterable so you can use
// for...of loop on it.
Show Answer

An object is an iterator if it has a next() method that returns { value, done }.

Q: `Object.create`
Prototypal inheritance.
Basic Implementation
const proto = { greet() { return "Hi"; } };
const obj = Object.create(proto);
console.log(obj.greet()); // "Hi"
Real World Example (Factory Pattern)
// Creating objects without constructor functions
// for cleaner composition.
Show Answer

Creates a new object, using an existing object as the prototype of the newly created object.

Q: `Reflect` API
Interception.
Basic Implementation
const obj = { x: 1 };
Reflect.set(obj, 'x', 2);
console.log(obj.x); // 2
Real World Example (Proxy Forwarding)
const handler = {
  get(target, prop, receiver) {
    console.log(`Getting ${prop}`);
    return Reflect.get(target, prop, receiver);
  }
};
Show Answer

Built-in object that provides methods for interceptable JavaScript operations. Used with Proxies.

Q: `Proxy` Object
Custom behavior.
Basic Implementation
const target = {};
const proxy = new Proxy(target, {
  get: (obj, prop) => prop in obj ? obj[prop] : 'Not Found'
});
console.log(proxy.foo); // "Not Found"
Real World Example (Validation)
// Validate property setting
set: (obj, prop, value) => {
  if (prop === 'age' && typeof value !== 'number') return false;
  obj[prop] = value;
  return true;
}
Show Answer

Enables you to create a proxy for another object, which can intercept and redefine fundamental operations for that object (like getting/setting properties).

Q: Temporal Dead Zone (TDZ)
let/const before declaration.
Basic Implementation
{
  // TDZ starts here
  console.log(x); // ReferenceError
  let x = 10; // TDZ ends here
}
Real World Example (Debugging)
// Helps catch bugs where variables are used before initialization
// unlike 'var' which would just be undefined.
Show Answer

The time between entering a scope and the actual declaration of a let or const variable. Accessing it throws a ReferenceError.

Q: `globalThis`
Universal global.
Basic Implementation
console.log(globalThis); 
// Window (Browser) or Global (Node)
Real World Example (Polyfills)
// Writing code that runs on both Server (SSR) and Client
if (typeof globalThis.window === 'undefined') {
  // Server side logic
}
Show Answer

Standard way to access the global object across environments (window in browser, global in Node).

Q: `BigInt`
Large integers.
Basic Implementation
const big = 9007199254740991n;
const sum = big + 1n;
Real World Example (Financials)
// High precision calculations where floating point math fails
// 0.1 + 0.2 !== 0.3 (Float)
// BigInt avoids this for integers.
Show Answer

Primitive for integers larger than 2^53 - 1. Created by appending 'n' to an integer literal.