I am looking for this stackoverflow question to be answered in Javascript.
So if my input is "word", the function should return:
word, Word, wOrd, WOrd, woRd, WoRd, etc..
here's what i have so far but it only produces the permutations (doesn't capitalize anything)
var perm = function(str){
var results = [];
var combos = function(reference, appendTo){
 appendTo = appendTo || "";
 if(reference.length === 0) {
  results.push(appendTo);
 }
 for(var i = 0; i < reference.length; i++){
  var current = reference.splice(i, 1);
  combos(reference, appendTo+current);
   reference.splice(i, 0, current)
 }
} 
combos(str.split(""));
return results;
}
perm("word");