I have a function that returns a random number from 1-10. When I use it in my other function it works once, but then it starts having an error that it's not a function. This isn't the exact code, just an example code that's similar. It produces an error saying "TypeError: Property 'ran' of object [object DOMWindow] is not a function" Why is it doing this?
Thanks alot
var buffer = [];
function ran() {
return Math.round(Math.random()*10);
};
function test(){
var size = 6;
for (i=0; i<=size;i++) {
var num = ran();
if (num === 2 || num === 3){
buffer.push(num);
};
};
};