title: Return a random selection from a string using Javascript
body: <p>I would like a suggestion on why my code isnt working. The idea is to select only three names from a the list of names randomly, but it can't return the same name twice. I think it is close but I'm missing something here. Any help would be appreciated</p>
  
  <pre><code>(function(){
  
    var randomNames = function(){
        var names = ["Jeffrey, Ronald, Superman, Lyndon, Alison"];
        var myNames = [];
  
        for (var i = 0; i &lt; 3; i++){
            var newNames = Math.floor(Math.random() * names.length);
            var randomAllNames = names[newNames];
            names.splice(newNames, 1);
            myNames.push(names);
            console.log(myNames);
        }
           return randomAllNames;
  
    }; randomNames();
  })();
  </code></pre>