['foo'] means 'a new array containing the string "foo"'. If you're trying to use variable variables, you're almost certainly doing something wrong. Instead, I suggest creating an object and assigning these values as properties of it using the square-bracket syntax as John said (but not on the global 'window' object).
As it stands, the only part that's different is the numerical part, so you could as well use an array:
Code:
function map(f, a) {
for (var i = 0, n = a.length, r = []; i < n; r[i] = f(a[i], i++));
return r;
}
function flip(f) {
return function(a, b) {
return f(b, a);
};
}
function compose(fa, fb) {
return function() {
fb(fa.apply(this, Array.prototype.slice.call(arguments)));
};
}
function f_prepend(a) {
return function(b) {
return a + b;
};
}
function makeSMarkers(sArray) {
return map(flip(f_prepend('clone')), sArray);
}
function addSMarkers(sArray) {
cloneIcon = makeSMarkers(sArray);
}
Bookmarks