Skip to content

Instantly share code, notes, and snippets.

@UlisesGascon
Created May 28, 2015 20:00
Show Gist options
  • Save UlisesGascon/a6e0d18d47eedb655730 to your computer and use it in GitHub Desktop.
Save UlisesGascon/a6e0d18d47eedb655730 to your computer and use it in GitHub Desktop.
isset() in JS ... like in PHP
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