Last active
August 29, 2015 14:13
-
-
Save EpokK/5ac56e0d73c1ffd62e14 to your computer and use it in GitHub Desktop.
Usefull Vanilla functions
This file contains 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
var isMobile = function() { | |
return !!navigator.userAgent.match(/Android|BlackBerry|BB10; Touch|iPhone|iPad|iPod|Opera Mini|IEMobile/i); | |
}; | |
Array.prototype.clone = function () { | |
return Array.prototype.slice.call(this, 0); | |
}; | |
Array.prototype.clear = function() { | |
this.length = 0; | |
return this; | |
}; | |
// Remove an item of array | |
Array.prototype.remove = function(from, to) { | |
var rest = this.slice((to || from) + 1 || this.length); | |
this.length = from < 0 ? this.length + from : from; | |
return this.push.apply(this, rest); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment