Skip to content

Instantly share code, notes, and snippets.

View PowerLevel9000's full-sized avatar
:octocat:
Open for new opportunities

Adarsh Pathak PowerLevel9000

:octocat:
Open for new opportunities
View GitHub Profile
@PowerLevel9000
PowerLevel9000 / array.ts
Created October 17, 2023 13:56
Custom Array
class ArrayDs {
length: number;
data: {};
constructor(...args: any) {
this.length = args.length;// Initialize the length of the array to track its size.
this.data = {};// Initialize the data object to store the items.
for (let i = 0; i < args.length; i++) {// fill the data object with the given items.
this.data[i] = args[i];
}
}