random number guess in javascript

technical talkiess
0

 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>
Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)