WayneISWayne;1209518 wrote:Is there a way to short and make this function faster, smaller and better?
function rand() {
var r = Math.floor(Math.random()*array.length);
document.getElementById('obj').innerHTML = array[r];
}
Don't know why you would want to do that but...
function rand() {
document.getElementById('obj').innerHTML = array[Math.floor(Math.random()*array.length)];
}
Unless you are repeating it like a million times, I don't think the space or time difference will be significant! 