Having an issue with this code snippet where nothing is being added. It seems like the variable result may not be taking a number or something else, but I'm not entirely sure why.
$(document).ready(function ()
//document.getElementById(1).style.display = "inline-block";
// https://www.youtube.com/watch?v=pqLS4oyJ8cA
array.prototype.randsplice = function(){
var rndNumber = Math.floor(Math.random()*this.length);
var lstSplice = this.splice(rndNumber,1);
return lstSplice;
}
var lstNumber = new Array(0,1,2,3,4,5,6,7,8,9);
var result = lstNumber.randsplice();
document.getElementById(result).style.display = "inline-block";
var result = lstNumber.randsplice();
document.getElementById(result).style.display = "inline-block";
var result = lstNumber.randsplice();
document.getElementById(result).style.display = "inline-block";
});
Attempting to utilize this resource: Randomly Empty a Javascript Array but have had no success so far. (keep in mind that all div elements have their style display set to none by default.)
If anyone can offer some assistance, it would be greatly appreciated. Thank you