You can try something like this:
Logic:
- Create a temp array so it does not replace original value.
- Calculate random number and use
% array.length
to find correct index.
- Use
array.splice(index, 1)
to remove the element from temp array, so that it will not repeat.
var arrayNum = ['One', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
function getRandomValues(arr, count){
var result = [];
var _tmp = arr.slice();
for(var i = 0; i