Created
January 27, 2021 10:46
-
-
Save darkcris1/521bd99574f233329a5ee48a8e1f6233 to your computer and use it in GitHub Desktop.
Array.includes | String.includes Polyfill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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