Skip to content

Instantly share code, notes, and snippets.

@mhcornejo
Created July 10, 2012 20:14
Show Gist options
  • Save mhcornejo/3085928 to your computer and use it in GitHub Desktop.
Save mhcornejo/3085928 to your computer and use it in GitHub Desktop.
Imprimir los numeros del 1 al 1000 sin bucles o condiciones
var functions = {
a1: function (number, max) { return print(number + 1, max); },
aNaN: function (number, max) { return null;}
};
function print(number, max){
document.write(number + '<br />');
var left = max - number;
var index = left/left;
return functions['a' + index.toString()](number, max);
}
print(1, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment