Last active
September 19, 2016 13:44
-
-
Save inferno7291/74a5242f3593daddb28265db7cb98b07 to your computer and use it in GitHub Desktop.
Functions on javascript
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
/** | |
* Saber si es un numero | |
*/ | |
function isNumeric(n) { | |
return !isNaN(parseFloat(n)) && isFinite(n); | |
} | |
/** | |
* Saber si es un integer | |
*/ | |
function isInt(n) { | |
return n % 1 === 0; | |
} | |
/** | |
* Reemplazar todos los elementos de un string | |
*/ | |
function replaceAll(string, find, replace) { | |
return string.replace(new RegExp(escapeRegExp(find), 'g'), replace); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment