Skip to content

Instantly share code, notes, and snippets.

@pasha1110
pasha1110 / index.js
Created March 9, 2021 00:57
How to check array startwith or endwith
//using Array.prototype
Array.prototype.startWith = function (query){
if (query === undefined) {
return this[0]
}else {
if (this === []|| this.length === 0){
return false
}else {
return (this[0] === query) ? true:false