Skip to content

Instantly share code, notes, and snippets.

@inferno7291
Last active September 19, 2016 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inferno7291/74a5242f3593daddb28265db7cb98b07 to your computer and use it in GitHub Desktop.
Save inferno7291/74a5242f3593daddb28265db7cb98b07 to your computer and use it in GitHub Desktop.
Functions on javascript
/**
* 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