1

I have an array with

[1,2,3,4,5]

I want to move "2" right (1 position at the time) or move "2" left

Can we do that with RxJS Operators?

Michalis
  • 6,247
  • 11
  • 47
  • 71

1 Answers1

6

you can do it with regular javascript

Array.prototype.move = function(from, to) {
    this.splice(to, 0, this.splice(from, 1)[0]);
};
samnu pel
  • 858
  • 5
  • 12