Created
May 28, 2015 20:00
-
-
Save UlisesGascon/a6e0d18d47eedb655730 to your computer and use it in GitHub Desktop.
isset() in JS ... like in PHP
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
function isset () | |
{ | |
var argumentos = arguments, | |
duracion = argumentos.length, | |
valorCero = 0, | |
undef; | |
if (duracion === 0) | |
{ | |
throw new Error('Empty isset'); | |
} | |
while (valorCero !== duracion) | |
{ | |
if (argumentos[valorCero] === undef || argumentos[valorCero] === null) | |
{ | |
return false; | |
} | |
valorCero++; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment