I have tried to write a javascript code to check whether we can form a word from the given string[jumbled].
    
    /**
    * tells you whether the given word could be formed from the given jumbled string
    * @param {string} word the word to be formed
    * @param {string} jumbledLetters the jumbled chars
    * @param {boolean} isSameLetter true if the word & jumbledLetters are same in length
    */
    function findWord(word, jumbledLetters, isSameLength) {
    if(isSameLength && word.length !== jumbledLetters.length) {
       return false;
    }
  
    var uniquePosition = {};
    for(var i = 0; i< word.length; i++) {
      for(var j=0; j< jumbledLetters.length; j++){
        // checks current chars are equal & the current char [j !== uniquePosition[j]] is not lookedup already
        if(word[i] === jumbledLetters[j] && j !== uniquePosition[j]) {
          uniquePosition[j] = j;
          break;
        }
      }
    }
    
    return Object.keys(uniquePosition).length === (word.length);
    }

We could do this with [string permutation](http://stackoverflow.com/a/9960925) with miron changes, but i tried something like the above one. Could you guys please suggest the refactoring to be done for the above code??