Pawan Kumar
Pawan Kumar
index.js ```js index.js /** * Detect the data type of any JavaScript value. * @param {any} value - Value to detect type of * @returns {string} Lowercase type name */...
index.js ```js index.js /** * Find corresponding node in two identical DOM trees. * @param {Node} rootA - Root of first tree * @param {Node} rootB - Root of second...
index.js ```js index.js /** * A store that uses DOM elements as keys. * Cannot use ES6 Map, must implement custom solution. */ class NodeStore { constructor() { this.store =...
index.js ```js index.js /** * Simple DOM wrapper with method chaining support. * @param {string} selector - CSS selector * @returns {object} wrapper with chainable methods */ function $(selector) {...
index.js ```js index.js import { Stack } from "./stack"; class Queue { constructor() { this.inStack = new Stack(); this.outStack = new Stack(); } enqueue(element) { this.inStack.push(element); } _shiftStacks() { if...
index.js ```js index.js const isObject = (obj) => typeof obj === 'object' && obj !== 'null'; /** * Immutability helper for nested updates. * @param {any} target - object or...
index.js ```js index.js /** * Creates a function that pipes values through a sequence of functions. * @param {Function[]} functions - array of unary functions * @returns {Function} composed function...
index.js ```js index.js /** * Returns a function that finds the first bad version using binary search. * @param {Function} isBad - predicate function * @returns {Function} finder function that...
index.js ```js index.js /** * Decodes hidden message using diagonal zig-zag traversal. * @param {string[][]} grid * @returns {string} */ export function decodeMessage(grid) { let decoded = ""; let row...
index.ts ```ts index.ts export const shuffle = (arr: number[]) => { let result: number[] = []; for (let i = 0; i < arr.length; i++) { const randIndex = Math.floor(Math.random()...