what is wrong with the code??
hello everyone i was trying to make a single perceptron learning model in js in my browser but i dont know why first it worked good for 2-3 time after that my browser crashed, i tried this many times same thing happened. please help me out(here is the code): var weights=[]; var n=3; var c=0.01;//learning constant //weights initialization console.log("initial weights \n"); for(let i=0;i<n;i++){ weights[i]=((Math.random()*2)-1).toFixed(3); console.log(weights[i]); } //train function /*function train(inputs,weights,c,desired,n){ var sum=0; for(let j=0;j<n;j++){ sum+=weights[j]*inputs[j]; //doing sum; } console.log("sum:"+sum+"\n"); var opt=activate(sum);//activating to get desired output console.log("des:"+opt+"\n"); var err=desired-opt; if(err===0){ console.log("all set perfect"); }else{ //minimizing error var newwt=learn(err,c,weights,inputs); console.log("---------------------------------------\n"); train(inputs,newwt,c,desired,n); } } //activation sign function function activate(sum){ if(sum>0){ return 1; }else{ return -1; } } function learn(err,c,weights,inputs){ for(let k=0;k<n;k++){ weights[k]+=err*inputs[k]*c; } console.log("new weights:\n"+weights+"\n"); return weights; } var inputs=[12,4,1]; train(inputs,weights,c,1,n); i tried running it in sololearn playground the same thing happened first it displayed the for 2-3 time and the when i tried running it again it was displaying running.... plz help me out