/js-array-implementation

This little project tries to siumlate Array data structure in JS. It has "MyArray" constructor and implementions of some Array methods.

Primary LanguageJavaScript

"MyArray" - Custom Javascript Array implementation

Methods added

  1. push & pop
  2. forEach
  3. indexOf && lastIndexOf
  4. map && filter
  5. join
  6. shift && unshift
  7. reverse
  8. reduce

Additional implementations

  • Constructing array by passing arguments like MyArray(1, 2, 3)
  • range static method to create arrays from given start and end points(works similar to one in Python)

Plans:

  1. Add shuffle method that shuffles the array elements
  2. Update the length when elements are added using arr[5] = "hello"

Feel free to contribute!