Skip to content

Instantly share code, notes, and snippets.

@darkcris1
Created January 27, 2021 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkcris1/521bd99574f233329a5ee48a8e1f6233 to your computer and use it in GitHub Desktop.
Save darkcris1/521bd99574f233329a5ee48a8e1f6233 to your computer and use it in GitHub Desktop.
Array.includes | String.includes Polyfill
if (!String.prototype.includes){
String.prototype.includes = function(value, fromIndex){
return this.indexOf(value, fromIndex || 0) > -1
}
}
if (!Array.prototype.includes){
Array.prototype.includes = function(value, fromIndex){
return this.indexOf(value, fromIndex || 0) > -1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment