Hey all,
This script below is just me trying to apply some of my knowledge of object oriented javascript but it's not returning an array, the result I expect it to return:
Code:
<script type="text/javascript">
window.onload = function(){
alert(Aby.randomize(Aby.age););
}
function Teen(age){
this.age = age;
}
Aby = new Teen(19);
Teen.prototype.randomize = function(randomizeAge){
var age = this.randomizeAge;
var count = 0;
var ageArray = [];
var num;
do {
num = Math.floor(Math.random() * this.age);
ageArray.push(num);
} while count < 4;
return ageArray
}
</script>
Thanks for any response.