// Define the methods export function जोड़ें(this: T[]): T[] { return this.concat(); } export function ढूंढें(this: T[], item: T): number { return this.indexOf(item); } export function अंत_में_ढूंढें(this: T[], item: T): number { return this.lastIndexOf(item); } export function में_शामिल_है(this: T[], item: T): boolean { return this.includes(item); } export function फॉर_इंडेक्स(this: T[], callback: (value: T, index: number, array: T[]) => void): void { for (let i = 0; i < this.length; i++) { callback(this[i] as any, i, this); } } export function कम_करना(this: T[], callback: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T { let accumulator: any = initialValue !== undefined ? initialValue : this[0]; for (let i = initialValue !== undefined ? 0 : 1; i < this.length; i++) { accumulator = callback(accumulator, this[i] as any, i, this); } return accumulator; } export function कम_करना_पिछला(this: T[], callback: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T { let accumulator: any = initialValue !== undefined ? initialValue : this[this.length - 1]; for (let i = this.length - 2; i >= 0; i--) { accumulator = callback(accumulator as any, this[i] as any, i, this); } return accumulator; } export function इंडेक्स_ढूंढें(this: T[], callback: (value: T, index: number, array: T[]) => boolean): number { for (let i = 0; i < this.length; i++) { if (callback(this[i] as any, i, this)) { return i; } } return -1; } // Add these methods to the Array.prototype declare global { interface Array { जोड़ें(): T[]; ढूंढें(item: T): number; अंत_में_ढूंढें(item: T): number; में_शामिल_है(item: T): boolean; फॉर_इंडेक्स(callback: (value: T, index: number, array: T[]) => void): void; कम_करना(callback: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; कम_करना_पिछला(callback: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; इंडेक्स_ढूंढें(callback: (value: T, index: number, array: T[]) => boolean): number; } } Array.prototype.जोड़ें = जोड़ें; Array.prototype.ढूंढें = ढूंढें; Array.prototype.अंत_में_ढूंढें = अंत_में_ढूंढें; Array.prototype.में_शामिल_है = में_शामिल_है; Array.prototype.फॉर_इंडेक्स = फॉर_इंडेक्स; Array.prototype.कम_करना = कम_करना; Array.prototype.कम_करना_पिछला = कम_करना_पिछला; Array.prototype.इंडेक्स_ढूंढें = इंडेक्स_ढूंढें;