/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Gets the millisecond equivalent of an interval //Example: (2).seconds() == 2000 Number.prototype.seconds = function(){ return this * 1000; }; Number.prototype.minutes = function(){ return this * 60000; }; //60 * 1000 Number.prototype.hours = function(){ return this * 3600000; }; //60 * 60 * 1000 Number.prototype.days = function(){ return this * 86400000; }; //24 * 60 * 60 * 1000 Number.prototype.weeks = function(){ return this * 604800000; }; //7 * 24 * 60 * 60 * 1000
Comments
