<!DOCTYPE html><html><head><title></title></head><body><pre><script>
// web can't wait for array creation for a single item
var digit_name_slow = function(n) {
var names = [ 'zero', 'one', 'two', 'three', 'four', 'five', 'six' ];
return names[n];
}
var digit_name = ( function() {
// function inits array, inner function returns an item
var names = [ 'zero', 'one', 'two', 'three', 'four', 'five', 'six' ];
return function(n) {
return names[n];
};
} () );
</script></pre></body></html>