random number guess in javascript
<script>
function guessExample(){
const n1 = Math.floor(Math.random() * 50) + 1 ;
var number = parseInt(prompt('Guess a number from 1 to 50: '));;
while(number !== n1){
var number = parseInt(prompt('Guess a number from 1 to 50: '));;
}
if(number == n1){
alert("right" + number);
}
}
guessExample();
</script>
Thanks you for commenting your questions. I will see question and respond you.