title: Javascript 500 Element Array
body: <p>i am backend PHP Developer and recently i have been trying to learn basic JavaScript as i am planning to work as Full stack developer, it's (hot in Market). I have this question which i can resolve in PHP easily but find it really hard to solve in JS, as js doesn't support built in functions for array like range(), shuffle and blah blah. so here's my simple question</p>
  
  <p>Q : Write a JavaScript function to generate a random array of 500 integers (values of 1 – 500 inclusive). Randomly remove and discard an arbitrary element from this newly generated array. Write the code to efficiently determine the value of the missing element.</p>
  
  <p>I have solved this in PHP which i am pasting here too in case.</p>
  
  <pre><code>// creating array with a range from 1-500
  $array_range = range(1, 500);
  
  shuffle($array_range);
  
  $array_shuffle = $array_range;
  
  $remove_elem = rand(1, 500);
  
  unset($array_shuffle[$remove_elem]);
  
  $missing_elem = array_diff($array_range, $array_shuffle);
  
  echo 'Value of missing element is : '.current($missing_elem);
  </code></pre>
  
  <p>Can someone help me with this how can i solve this? 
  P.S thanks in advance and sorry for long question</p>