All streams
Search
Write a publication
Pull to refresh
0
0
Send message
Я конечно не занимаюсь разработкой на js, но мне кажется, что такой код должен сработать:
var consume = function (source, quantity) {
  if (!source) {
    return [];
  }
  if (quantity <= 0) {
    return source;
  }
  var first = source.shift();
  return consume(source, quantity - first);
}

Information

Rating
Does not participate
Registered
Activity