Hi can someone guide me how to write these code in oop?
<script type="text/javascript">
return answer;
var rslt=0;
var answer= "";
var a,b,c;
var fill = new Array(50);
function Random(min,max)
{return Math.floor(Math.random() * (max - min + 1)) + min;}
function myTwoDArray(){
var string="";
var myArray= new Array (20);
var position=0;
fillarrayindex(1);
for(var i=0;i<10;++i){
myArray[i]=new Array(20);
for(var j=0;j<10;++j){
if(fill[position]==0){
string=badRandom();
position++;
myArray[i][j]=1;
}
else{
string=goodRandom();
position++;
myArray[i][j]=2;
}
}
}}}
function fillarrayindex(j){
for (i=0;i<y;i++){
no = getRandom(0,20);
fill[no]=1;
}
return fill;
}
function goodrandom ()
{
a = Random(0,1000);
b = Random(1,100);
c = Random(200,300);
if ((a%2)==0){
rslt = b+c;
answer =b+ c + result;
return answer;
}
else{
rslt = b-c;
answer = b + c +result;
return answer;
}
}
function badrandom(){
a = Random(0,1000);
b = Random(1,100);
c = Random(200,300);
var badNum = getRandom(0,10);
result= a+b;
if (badNum==result){badNum++;}
if ((a%2)==0){
answer = b + c + badNum;
return answer;
}
else{
answer = b + c + badNum;
return answer;
}
}
</script>