index.js
function containedInOrder(needle, haystack) {
  var i, j = 0;
  for (i = 0; i < needle.length; i++) {
    while (j < haystack.length && needle[i] !== haystack[j]) j++;
  }
  return i === needle.length && j < haystack.length;
}
function containedInOrder(needle, haystack) {
  var i, j = 0;
  for (i = 0; i < needle.length; i++) {
    while (j < haystack.length && needle[i] !== haystack[j]) j++;
  }
  return i === needle.length && j < haystack.length;
}
function containedInOrder ( needle , haystack ) { var i , j = 0 ; for ( i = 0 ; i < needle . length ; i ++ ) { while ( j < haystack . length && needle [ i ] !== haystack [ j ] ) j ++ ; } return i === needle . length && j < haystack . length ; }
Test that each item in needle is contained in haystack in the right order.
Test that each item in needle is contained in haystack in the right order .