slice function

dynamic slice(
  1. dynamic a,
  2. dynamic b,
  3. dynamic from,
  4. dynamic to,
)

Implementation

slice(a, b, from, to) {
  for (var i = from, j = 0; i < to; i++, j++) {
    if (a.length == j) {
      a.add(b[i]);
    }
  }

  return a;
}