title: Using an array element only once
body: <p>I am new to JavaScript and I would like to get three random elements out of my array, which need to be different. I already managed to get three different elements, then I tried to take one element only once via the split method. But apparently this doesn't really work, there are probably a lot of mistakes since this is one of my first scripts. Also it sometimes says "undefined".</p>
  
  <p><a href="http://jsfiddle.net/t4mtpm50/" rel="nofollow">http://jsfiddle.net/t4mtpm50/</a></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;span id="tot1"&gt;&lt;/span&gt;, &lt;span id="tot2"&gt; und &lt;/span&gt; und &lt;span id="tot3"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function getNumber() {
      random = Math.floor(Math.random() * students.length);
      students.splice(random,1);
      return random;
  }
  
  students = new Array("Paul", "Jan", "Fabian D.", "Fabian K.", "Lennard", 
                              "Robin", "Angelique", "Joyce", "Sarah", "Ajlin",
                              "Enes", "Leon", "Boran", "Joshua")    
  
  getNumber();
  tot1 = students[random];
  getNumber();
  tot2 = students[random];
  getNumber();
  tot3 = students[random];
  
  document.getElementById('tot1').innerHTML = tot1;
  document.getElementById('tot2').innerHTML = tot2;
  document.getElementById('tot3').innerHTML = tot3;
  </code></pre>