Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var foo = ["1", 2, 3, 4, "5"];
function create_functions_array(array) {
    var functions_array = new Array;
  
  for(var i=0; i<array.length; i++) {
       functions_array[i] = function (i) {
         return function() {
           return array[i];
         };
       }(i)
    }
  
    return functions_array;
}
var bar = create_functions_array(foo);
console.log(bar[0]())
console.log(bar[1]())
console.log(bar[2]())
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
_alexander_pro
0viewers