Skip to content

Instantly share code, notes, and snippets.

@hiroshi-maybe
Last active December 16, 2015 20:39
Show Gist options
  • Select an option

  • Save hiroshi-maybe/5494372 to your computer and use it in GitHub Desktop.

Select an option

Save hiroshi-maybe/5494372 to your computer and use it in GitHub Desktop.
A function to check sublist.
var isSublist = function(a,b) {
var a_idx=0;
for(var b_idx=0; b_idx<b.length; b_idx+=1) {
if (a[a_idx]==b[b_idx]) {
if (a_idx==a.length-1) {
return true;
}
a_idx+=1 ;
}
}
return false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment