Exercise 1 - Guess the Number | JavaScript Tutorial in Hindi #22

  Рет қаралды 266,445

CodeWithHarry

CodeWithHarry

Жыл бұрын

Link to the Repl - replit.com/@codewithharry/22E...
Join Replit - join.replit.com/CodeWithHarry
Download Notes - www.codewithharry.com/notes/
Ultimate JS Course Playlist: • JavaScript Tutorials f...
►Checkout my English channel here: / @programmingwithharry
►Instagram: codewithharry
python, C, C++, Java, JavaScript and Other Cheetsheets [++]:
Playlist: • Coding CheatSheets 🧾 b...
►Learn in One Video[++]:
Python[15 Hr] - • Python Tutorial For Be...
Python Advance[3.5 Hr] - • Python Programming Cou...
Python[1 Hr] - • Learn Python In Hindi ...
Python[2 Hr] - • Python Tutorial In Hin...
Python[15 Min] - • 15 Minute Python Tutor...
JavaScript[1 Hr] - • JavaScript Tutorial
C[1.3 Hr]- • C Programming Tutorial...
php[1 Hr] - • Learn Php In One Video...
php[2.3 Hr] - • Php Tutorial for Begin...
php[Project]- • Login And Registration...
HTML[30 Min] - • HTML 5 Tutorial For Be...
CSS[8.5 Hr] - • CSS Tutorial In Hindi ...
CSS[1.4 Hr] - • CSS 3 Tutorial For Beg...
Wordpress[3.2 Hr] - • How To Make a WordPres...
Angular[2 Hr] - • Angular Tutorial in Hindi
Java[2.3 Hr] - • Java tutorial in hindi 🔥
Web Scraping[1 Hr] - • Web Scraping Tutorial ...
MongoDB[2 Hr] - • MongoDb Tutorial For B...
Numpy[1 Hr] - • Numpy Tutorial in Hindi
Android Dev[12 Hr]- • Android Development Tu...
Linux[1 Hr] - • Linux Tutorial For Beg...
JQuery[1.1 Hr] - • jQuery Tutorial For Be...
Git and GitHub[1.1 Hr] - • Git & GitHub Tutorial ...
►Complete course [playlist]:
React - • React Js Tutorials in ...
Python- • Python Tutorials For A...
OOP Python- • Object Oriented Progra...
Java - • Java Tutorials For Beg...
JavaScript- • JavaScript Tutorials I...
PHP- • PHP Tutorials in Hindi
C- • C Language Tutorials I...
C++- • C++ Tutorials In Hindi
Git & GitHub- • Git and GitHub Tutoria...
Android Dev- • Android Development Tu...
Python GUI- • Python GUI: Tkinter Tu...
Web Development- • Web Development Tutori...
Python Django - • Python Django Tutorial...
Projects Using HTML, CSS & Javascript- • Projects Using HTML, C...
Data Structure and Algo - • Data Structures and Al...
Follow Me On Social Media
►Website (created using Django Rest & Angular) - www.codewithharry.com
►Facebook - / codewithharry
►Instagram - / codewithharry
Twitter - / codewithharry
Comment "#HarryBhai" if you read this 😉😉

Пікірлер: 826
@CodeWithHarry
@CodeWithHarry Жыл бұрын
Happy Independence Day everyone :)
@chandanprajapati9704
@chandanprajapati9704 Жыл бұрын
Same to you harry bhai.. 🇮🇳 ❤️
@shaktiexcellentchannel7834
@shaktiexcellentchannel7834 Жыл бұрын
Mera comments high light Kijiji comments box pe please Bhai 🎉🎉🎉🇮🇳💐💐🙏🙏🙏💐🙏💐💐💐💐🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳
@rahilkarkar7727
@rahilkarkar7727 Жыл бұрын
Happy independence day Harry bhai
@MJGameZone
@MJGameZone Жыл бұрын
Same 2 u bro...
@code_with_ayush
@code_with_ayush Жыл бұрын
Same to you🇮🇳🇮🇳
@nitubhuwalka9620
@nitubhuwalka9620 Жыл бұрын
I did the same program in python from your course by myself and now this time through javascript course...... Thank you harry
@tirthsorthiya6320
@tirthsorthiya6320 Жыл бұрын
There is magic in harry bhai's words that I started writing the code without seeing time and when I finished I saw it was 1am at night. It is because of harry Bhai Harry bhai is really great.
@CodeWithHarry
@CodeWithHarry Жыл бұрын
Code Backup Repository: github.com/CodeWithHarry/ultimate-js-course-youtube
@yashvantjankar8905
@yashvantjankar8905 4 ай бұрын
Let num = Math.round((Math.random)*100); Console.log(num); Random number is done
@sobansaleem3492
@sobansaleem3492 3 ай бұрын
@@user-kq5up7fy2u what's the +1 for?
@chetanazambare7674
@chetanazambare7674 Жыл бұрын
Thank so much for this course harry. your dedication to explaining each and every concept so easily is very appreciable.
@hrithik5220
@hrithik5220 Жыл бұрын
Legend Harry Bhai🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 Aapka complete 1 video Wala hrml css course ne aag laga diya .thankyou so much
@Shakeel7573
@Shakeel7573 Жыл бұрын
Harry you are a best IT teacher. Your method of explanation is not only good but also at next level. I am Shakeel from Punjab Pakistan.
@learndigitalskills8932
@learndigitalskills8932 Жыл бұрын
Bro! You are doing great, I'm wartching 4 videos of this playlist daily, I did this exercise today, You are giving such a premium course in free. Thank you
@samirbante8554
@samirbante8554 Жыл бұрын
Sikh gaya kya javascript
@learndigitalskills8932
@learndigitalskills8932 Жыл бұрын
@@samirbante8554 yes
@HM-sid
@HM-sid Жыл бұрын
Thanks sir for valuable content!🙏
@gentlyroasting4049
@gentlyroasting4049 Жыл бұрын
HARRY WHERE SHOULD WE DISCUSS ANY FURTHER MORE QUESTIONS? IT WOULD BE GREAT if there is a group for us🙏.THANK YOU FOR TODAY'S CLASS!!🔥🔥 #HarryBhai
@thomasshelby447
@thomasshelby447 11 ай бұрын
let a = Math.random() * 100 a = Math.round(a) let b = prompt("guess the number") let chances = 1 while (a != b) { console.log("the number is ", a < b ? "less than " + b : "greater than " + b) b = prompt("guess the number again") chances += 1 } console.log("you guessed it right") console.log("you took "+chances+" chances to guess the right number")
@Richhera
@Richhera 3 ай бұрын
Bhai tera comment try karke muje lagra hai abhi muje kuch nahi aya hai
@azharuddinansari8867
@azharuddinansari8867 Жыл бұрын
thanks for giving such a interesting quizes, Harry Bhai!!!
@rohandabgar6626
@rohandabgar6626 Жыл бұрын
You are such a great teacher. i never see teacher like yours. Thank u harry sir 🙏
@tirthsorthiya6320
@tirthsorthiya6320 Жыл бұрын
This are the teachers we want. right?
@anonyone8834
@anonyone8834 Жыл бұрын
3:37 after this I paused the video and wrote this code, btw idc if i am late and I can't win but instead I got a question, a challenge, that motivated me alot when I had written this code under 5 minutes. IDK if its good/bad but as a beginner programmer, I like my time let num = Math.floor(Math.random() * 100) let usrinput = prompt("Guess the Number:") let guesses=0 usrinput = parseInt(usrinput) while (num != usrinput) { console.log("Wrong number") if (num > usrinput) { console.log("The correct number is Greater") } else { console.log("The correct number is smaller") } usrinput = prompt("Guess the Number:") usrinput = parseInt(usrinput) guesses++ } console.log("YOU GUESS THE RIGHT NUMBER, YOU ARE SOOOO PRO YOUR SCORE IS:", 100-guesses)
@adityameena7536
@adityameena7536 Жыл бұрын
Sir Me apke web development ke course ko study ke rha hu. Aap ke course ki wjh se mujhe kabhi help Hui h HTML, CSS and JS ko sikhne me
@pg_piyush
@pg_piyush Жыл бұрын
Bhaiya... I am going to start my BTECH CSE journey Soon Plz make a video.. on how a students should start it learning with your courses Since you had made so many courses and playlist. Plz guide ‼️
@mrperfect6700
@mrperfect6700 Жыл бұрын
Bhai same here yarr...
@samirbante8554
@samirbante8554 Жыл бұрын
Bhai c to sikh le pehle
@Suraj03.
@Suraj03. Жыл бұрын
thanks for the exercise ---> 😀 here is the code --> let chances = 1; //The random number let number; number = Math.random()*100; number = Math.round(number); //the while loop for tries let value; do{ value = prompt("Enter an number :- "); if(number > value){ console.log("the number is bigger"); }else if(number < value){ console.log("the number is smaller"); }else{ console.log("your luck is ongoing"); } chances+=1; }while(number!=value) console.log("The total score is :- " + `${100-chances}`) note :- to find the number it took me lot of tries ...
@shivamtiwari4293
@shivamtiwari4293 Жыл бұрын
Knowledgeable👍👍👍 Thanks for making this JavaScript course🙏🙏🙏
@metaaffinity
@metaaffinity Жыл бұрын
you can create this with this way //generate random number var random = Math.floor(Math.random()*100); console.log(random) // input by prompt and total 10 chances let input; let chances = 0; let tries = 0; do { input = Number.parseInt(prompt("enter your guess")); if(randominput){ console.log("guessed number is greater than "+input); } chances+=1; tries+=1 } while(random != input){ console.log("Good! you have gussed the number in "+tries+" tries") console.log(`your have earned ${100-chances} points`); }
@0xvineet
@0xvineet 8 ай бұрын
bro apka print just opposite ho rha ,,, suppose random number 45 hai ,, to 50 input dene pr show krega "guess number is less than 50 and vise versa for 30 as input
@kinggamer-xv3kx
@kinggamer-xv3kx Жыл бұрын
Thanks Harry bhai for the voucher but hum chahte hai ki aap hume roj aise hi homework dete rhe taaki hum or bhi aacha kr ske
@asifali-fc8xt
@asifali-fc8xt Жыл бұрын
Mr Harry hope aap javascript k is tutorial main Math.random or ye sari exercises sahi tarikey sy samjhein gy or is par khas focus karna hy aap ny koi point reh na jaey hope agey any waley lectures main aap random function ko briefly explain karein gy thanks, main is toturial ko regularly follow karta hn
@myself_ripon
@myself_ripon Жыл бұрын
Iss game me bohot mazza aya harry bhai😍😍
@poor_thang
@poor_thang 11 ай бұрын
bro..wo Harry hai, kuch bhi kar sakta hai... sadak se utha ke star bana sakta hai, thank you so much bro, tumne ek mech engineer se logic build karwa liya randomNo) { console.log("Entered number is greater than random number."); } else if (userInput
@CodingWorld202
@CodingWorld202 6 ай бұрын
Now this what we call a top notch quality content.
@muma9353
@muma9353 Жыл бұрын
Your videos are just awesome ...
@sirari00
@sirari00 Жыл бұрын
Here is my approach....( i did it, not for first time but tried it 3 to 4 times but also saw some comments for the solution. My approach was firstly wrong in the while loop which was giving me run-time infinite loop error and also i have not understood the que properly but after seeing some solution i tried myself. Also I am seeing my approach a little bit copied but it is what it is 🙂) let r_no = Math.floor((Math.random() * 100) +1) console.log(r_no) let g_no let luck = 1 while (g_no!=r_no) { g_no = Number.parseInt(prompt('let\'s guess the no')) if(g_no>100){ console.log('plz Enter no between 1 & 100') } else if(g_no>r_no){ console.log('Guessed no.is big compared to random') } else if(g_no
@CrazeGamerz786
@CrazeGamerz786 2 күн бұрын
Hello Harry Sir I am watching this video now I just created this code in vs code editor thanks var num = Math.ceil(Math.random() * 100); console.log(num); var gnum = prompt(" the guess number between 0 and 100" ) if (gnum == num) alert("the number matched Good Work and number is: " +gnum); else{ alert('Not matched , try again and number is ' +gnum); }
@BhaktaBhusanDas
@BhaktaBhusanDas Жыл бұрын
Harry bhai, maja aagaya.
@lakshyarajdash
@lakshyarajdash Жыл бұрын
I was just waiting for the first exercise of this course and here it is. I've completed and posted my repl in your 22_Exercise_1 repl. Please checkout the solution. This was an amazing and easy exercise.
@gondsarthak1018
@gondsarthak1018 Жыл бұрын
harry bhai 30 mins lge lekin without cheating just reference k liye math.random dekha and baaki sb khud hi kiya thank you so much sir❤❤
@Gaurav_Short
@Gaurav_Short Жыл бұрын
let point = 100; let lifes =5; let randN = Math.round(Math.random()*100) console.log('Hint: Number between(1 -100)'); do{ console.log('Your lifes: '+lifes) let userN = prompt('Enter Your Guess ?') if(userN==randN){ console.log('You Are Champion :D') console.log('Your Score: '+point) break } else if(userN>randN){ console.log('Your guess is high') point-=10; } else if (userN < randN){ console.log('Your guess is low') point -= 10; } lifes -= 1; }while(lifes>0) console.log('The Number is: '+randN)
@th_gauravthakur
@th_gauravthakur Жыл бұрын
❤️
@sarjeevanrajput7684
@sarjeevanrajput7684 Жыл бұрын
Best 👍
@karenariash643
@karenariash643 Жыл бұрын
💯
@Gaurav_Short
@Gaurav_Short Жыл бұрын
@@th_gauravthakur thnx
@Gaurav_Short
@Gaurav_Short Жыл бұрын
@@karenariash643 thx
@jatinnandwani6678
@jatinnandwani6678 Жыл бұрын
Thank you bhai This course is helpful
@KrishnaAbhale-cn9qy
@KrishnaAbhale-cn9qy 3 ай бұрын
Because of your quick quiz I have learned a lot. Thank you bhai. I will give you prize after getting job
@radheravi1285
@radheravi1285 Жыл бұрын
@CodeWithHarry Bhaiya Score 100-NumberOfCount means maximum score is 99 , so wahan 101-NumberOfGuess Hona Chahiye , if some one guessed in first attempt then his/her score will be 100
@ankursharma1822
@ankursharma1822 7 ай бұрын
let score = 0; let r = Math.ceil(Math.random()); console.log(r) for(let i = 1;i userInput){ score+=1; } else if(r < userInput){ score+=1; } else{ break; } } let res = (100 - score); console.log(res);
@ashblake894
@ashblake894 Жыл бұрын
For those who want the code here (Guess the number between 0 and 100): let random = Math.floor(Math.random() * 101); console.log(random) let chances = 0; let input; while (input != random){ input = Number.parseInt(prompt("Enter a Number between 0 to 100")); if(input != random){ console.log("Wrong! Try again.")} if (random>input){ console.log("The Number is bigger than " + input) } else if (random
@mohammadabbas1623
@mohammadabbas1623 Жыл бұрын
it's not the correct approach
@ashblake894
@ashblake894 Жыл бұрын
@@mohammadabbas1623 What is the right approach?
@sabinsapkota5953
@sabinsapkota5953 Жыл бұрын
you are good at this buddy.
@amit_vyas17
@amit_vyas17 Жыл бұрын
@@mohammadabbas1623 yes you are right there should be nested loops as we have to check the condition again and again although this code working fine but at some point it will create a bug and the correct code is ======= let number = Math.floor((Math.random() * 100) + 1); console.log(number) let chances=0; let input; while(input != number){ input = Number.parseInt(prompt("Guess the number between 0 to 100")) if(input!= number){ console.log("Try again!! You guessed it wrong") if(input > number){ console.log("Your guessed number is bigger than the random number") } else{ console.log("Your guessed number is smaller than the random number") } } chances++; } console.log("Woahh You guessed the right number") console.log("Your score is " + (100-chances) + " and the number is " + number)
@knandinij
@knandinij Жыл бұрын
In d last statement by mistake curly brace is used .program is correct
@SombitPramanik
@SombitPramanik Жыл бұрын
wow harry vai 😍 😍 I am currently following your full web development playlist (103 videos) and simultaneously follow this full java script playlist for batter learning. unfortunately i am not able to participate that challenge but in future i try my best with your support . thangs harry vai love from West Bengal 😍
@educationalxentertainmente9351
@educationalxentertainmente9351 Жыл бұрын
Hah! West bengal
@educationalxentertainmente9351
@educationalxentertainmente9351 Жыл бұрын
Me too!
@educationalxentertainmente9351
@educationalxentertainmente9351 Жыл бұрын
Shall we learn and make projects together??
@SombitPramanik
@SombitPramanik Жыл бұрын
@@educationalxentertainmente9351 yes contact me on email
@educationalxentertainmente9351
@educationalxentertainmente9351 Жыл бұрын
@@SombitPramanik how can I know Email
@sayakbanerjee528
@sayakbanerjee528 9 ай бұрын
Harry Bhai no amount of amazon vouchers can do what you do for us for free on a daily basis. forever indebted to you man 🙏🙏
@aashishmiglani5878
@aashishmiglani5878 Жыл бұрын
let x = Math.random() * 100; x = Number.parseInt(x) console.log(x) let y let chance = 0 while (y != x) { y = prompt("Enter the number") y = Number.parseInt(y) if (y < 101) { if (x > y) { console.log("Number is greater :Keep guessing") } else if (x < y) { console.log("number is lesser : Keep Guessing") } else { console.log("Great Work You guessed Right") } } else { console.log("Enter a Vaild Number") } chance++ } let guessing = 100 - chance console.log("Your Score is ", guessing) Thanks For This Playlist
@gayaprasad2291
@gayaprasad2291 Жыл бұрын
Hello, Sir Solution of Sourabh Gautam: let x; let score = 0; let y = Math.floor(Math.random() * 100) do{ x = Number.parseInt(prompt()); if(x>y){ console.log(`${x} is greater than the Random Number`) } else if(x
@akshaynagarwal
@akshaynagarwal Жыл бұрын
Here y returns between 0-99 ,but the question have 1-100.
@taran1985
@taran1985 Жыл бұрын
Where did the code check the number of chances given?
@umarjanbhat3819
@umarjanbhat3819 Жыл бұрын
add 1 to y and you are good to go. 1 and 100 will be inclusive in this formula.
@gloryjaw4327
@gloryjaw4327 Жыл бұрын
I think you should post this in comment section of replit
@kiduboy45
@kiduboy45 Жыл бұрын
Nice bro
@sarthaksinghal9269
@sarthaksinghal9269 Жыл бұрын
You are the best teacher right now I am your fan kya samjhate ho bhai aap
@Tekista
@Tekista Жыл бұрын
Harry bhai please devops ke bare me and roadmap par ek video bnao. I'm a 2nd year student and want to develop skillet in devops. Btw love your content ❤️🧡🤍💚
@Huihuihuihuihui..
@Huihuihuihuihui.. 2 ай бұрын
do { var a=prompt('enter a number') console.log('Entered wrong number..') var c=Math.floor(Math.random() * 10) + 1; // var b =Number.parseInt(a) } while (a!=c) console.log('you have entered a correct number')
@iqbalshaikh5874
@iqbalshaikh5874 11 ай бұрын
I didn't make till end but I made a program that generates random number and if entered wrong it prints "wrong number" with random number generated. I only google for math.floor(math.random). Other things i did by my self. I think this course provides value....
@gamezone7619
@gamezone7619 2 ай бұрын
let rnd=Math.random()*100+1 console.log(rnd) let input=prompt("enter a number to check you are close or not") input=Number.parseInt(input) if(rndinput) { console.log("your guess is less") console.log("actual number is ",rnd) } else if(rnd
@yuvraj__technical9400
@yuvraj__technical9400 Жыл бұрын
Thanks for like this content Much more productivity😊
@akjunior3617
@akjunior3617 Жыл бұрын
Thank you, Harry bhai
@Saniyakhan0729
@Saniyakhan0729 Жыл бұрын
Love you Harry bhai🤩
@Intelli_Jayant
@Intelli_Jayant Жыл бұрын
Harry Bhai ye wala project hum logo ne c programing wale video me kiya tha, isiliye logic to pata hai bs JS me syntax ko likhna hai
@STEVE-tl4vh
@STEVE-tl4vh Жыл бұрын
Heres the solution: let x = Math.random() * 100; Math.round(x) x = Number.parseInt(x) let inp = prompt("Guess the number from 1 - 100: ") let count = 0 do { if (x > inp) { console.log("You guessed lower") inp = prompt("guess again: ") count++ } else if (x < inp) { console.log("You guessed higher") inp = prompt("guess again: ") count++ } else { console.log("You guessed it right!") } } while (x != inp) if (x == inp) { console.log("You guessed it right!") } let score = 100 - count console.log("Your score is", score)
@vgk-lm8vl
@vgk-lm8vl 10 ай бұрын
let randomNumber=Math.floor(Math.random()*101),obj=[] let score=100; let chances=0,convert; let ask=prompt("Enter hidden number") chances++; while(ask!=randomNumber){ ask=prompt("You Enter wrong enter again") chances++; ask=Number.parseInt(ask) if(ask>randomNumber){ alert("Please enter lower number!") obj.push(ask) } else if(ask
@zero8717
@zero8717 9 ай бұрын
For those who want the code let x = Math.floor((Math.random()*100)+1) let chances = 0; let input = 0 while(input != x){ input = Number.parseInt(prompt("Enter number between 0 to 100")) if(input > x){ console.log("The number is smaller than " +input) } else if(input < x){ console.log("The number is bigger than " +input) } chances++ } console.log("Congrats Champ") console.log("Your score is " +(100 - chances)+ " and number is " +x)
@MirUrfeey
@MirUrfeey 4 ай бұрын
Thnx
@knowledgekiduniyakkd
@knowledgekiduniyakkd 5 ай бұрын
let num = Math.floor(Math.random() * 100) + 1; let chances = 0; for(let i=0; i num) console.log("To high"); } }
@shivpathak5897
@shivpathak5897 Жыл бұрын
let n=Math.floor(Math.random()*100) let m=prompt("enter the nuber") let c=0 while(m!=n){ if(m>n){ m=prompt("enter lesser number") c++ } if(m
@Shekhuguruji
@Shekhuguruji Ай бұрын
there is a flaw, your code will generate a random number between 0 to 99, not 1 to 100
@kashif2niazi
@kashif2niazi Ай бұрын
@@Shekhuguruji let n=Math.floor(Math.random()*99)+1
@Shekhuguruji
@Shekhuguruji Ай бұрын
@@kashif2niazi yep this is correct now
@nevergiveup8987
@nevergiveup8987 Жыл бұрын
Thankyou harry sir❤😊
@dhruvkumar1065
@dhruvkumar1065 Жыл бұрын
let number = Math.random() number = number*10 number = Math.floor(number)+1 let guess = 0 do { guess = prompt("Enter your guess between 1-10") guess = Number.parseInt(guess) console.log(guess == number?"MATCHED":"TRY AGAIN!!") } while(number != guess)
@user-nz8de4hc6z
@user-nz8de4hc6z 7 ай бұрын
let num = Math.floor(Math.random() * 100) + 1; console.log(num) let b = prompt("Enter the number"); b =Number.parseInt(b); if(num==b){ console.log("You entered the correct number ", +b+ "which is equal to "+num) }else if (numb){ console.log("The number " +num+ " is greater than the entered number ",+b) } Ghalti nikal dain .I'm new and learning javascript for the very first time from any youtube channel
@royfamily9273
@royfamily9273 7 ай бұрын
Thanks Harry Bhaiya
@yashkushwahablog8238
@yashkushwahablog8238 Жыл бұрын
Same to u sir
@RamanKumar-xu7cq
@RamanKumar-xu7cq 3 ай бұрын
const prompt = require("prompt-sync")(); let arr = 87; const arr1 = Array.from(String(arr), Number); let chances = 1; let a; do { if (a < arr) { console.log("Your number is less than the actual number"); chances++; } else if (a > arr) { console.log("Your number is greater than the actual number"); chances++; } a = prompt("Enter your number"); a = Number.parseInt(a); arr1.push(a); } while (a != 87); console.log("Your score is ", 101 - chances); console.log(arr);
@user-vl5kj3vy9b
@user-vl5kj3vy9b 10 ай бұрын
I would like to thank you Harry. Here is my first Javascript code:- console.log("Welcome to my guess the number game!"); let a = Math.floor(Math.random()*100); console.log(a); //make it a comment to make it more interesting let b; //compare two values let count = 0; do{ b = Number.parseInt(prompt("Guess the number generated by Computer")); if(ba) console.log("You entered a number which is greater than autogenerated number") count++ }while( b!=a) console.log("Huraah! You entered a correct number"); console.log("Total number of guesses:- " +count); //game ended
@ranaroy9938
@ranaroy9938 Жыл бұрын
thanks harry bhaia
@priyanshutyagi_02001
@priyanshutyagi_02001 5 ай бұрын
Thankyou harry bhai❤
@MachineBuzz
@MachineBuzz Жыл бұрын
thank you harry bhai apke kimte vakt ke liye the code below is the answer of the following exercise let cn = Math.floor(Math.random()*100)+1; let n = prompt("Enter the expected Number btw 1 to 100") n = Number.parseInt(n) let i=0; while(n!= cn ){ {if(n0){ alert("Less than correct Number") n = prompt("Enter the expected Number btw 1 to 100") } else if(n>cn){ alert("Greater than correct Number") n = prompt("Enter the expected Number btw 1 to 100") } else if(n
@SouthAsiaEntertainment
@SouthAsiaEntertainment 7 ай бұрын
let a=(Math.random()*51); a=Number.parseInt(a); console.log(a); let b=prompt("Enter Guessed Number(Hint Number is in between 1 to 50)"); b=Number.parseInt(b); if(b>a){ console.log("Enterd number is greater than number"); } else if(b
@user-nj3ex5li7w
@user-nj3ex5li7w 4 ай бұрын
let num = Math.floor(Math.random() * 100) + 1; let count = 0 do{ count++ let guess = prompt("Guess the number: ") if(guess == num){ break; }else if(guess
@Rahuldudi1349
@Rahuldudi1349 11 ай бұрын
i'm glad i did it without watching this video . let rn = Math.round(Math.random() * 99 + 1); guess = Number.parseInt(prompt("Guess the number")); while (guess != rn) { alert(`your number is ${guess < rn ? "smaller" : "bigger"}`); guess = Number.parseInt(prompt("Guess the number")); }; console.log(`You got it, the number is ${rn}`)
@amitranjeetjha1240
@amitranjeetjha1240 Жыл бұрын
This course is helpful
@dxdelvin
@dxdelvin Жыл бұрын
YESSSSSS MAJJA AYA BHAI
@lovelysharma9897
@lovelysharma9897 Жыл бұрын
Please is ke bad react js ka bhi course bnao ,easy to learn .this ultimate js course is really ultimate
@dipalikutmure1523
@dipalikutmure1523 Жыл бұрын
Yes we need it
@nileshvishwakarma8166
@nileshvishwakarma8166 Жыл бұрын
Always have facts in your video
@Elderny
@Elderny Жыл бұрын
const winnum = Math.floor(Math.random()*100) let chances = 2 const ask = () => { if(chances){ chances-- const number = prompt('enter what you think') if(number == winnum){ alert('you won');chances = 2 }else{ alert('try again');chances-=1 } } } ask()
@heyitsritu
@heyitsritu Ай бұрын
const prompt = require("prompt-sync")() ; let ranNum = Math.floor((Math.random())*100); let chances = 5 do{ let num = prompt("Guess...??") if(ranNum == num){ console.log("you won"); break; }else{ console.log((num
@jeetmajumdar7588
@jeetmajumdar7588 Жыл бұрын
I already did it using Java But very sad don't post it😂😂😂 Thank you harry Bhai ❤️❤️❤️
@diptiranjan18
@diptiranjan18 Жыл бұрын
Yes Stone paper scissors waala question 😂
@lodhiyavishnu4714
@lodhiyavishnu4714 Жыл бұрын
Yeah 😂
@rahulmeena5869
@rahulmeena5869 Жыл бұрын
Happy independence day to one of my favourite teacher
@atharva_A
@atharva_A 8 ай бұрын
let min = 1; let max = 5; let chances = 0; let randomnumber = Math.floor(Math.random() * (max - min + 1)) + min; const userinp = () => { return Number(prompt("Enter A Number:- ")); }; while (true) { let uinp = userinp(); chances++; if (uinp === randomnumber) { console.log("Congrats you have won!"); break; } else { console.log("Try Again!"); } } console.log("Number of chances it took you to guess the correct number is: " + chances); my attempt
@anuragsinghp2p
@anuragsinghp2p 3 ай бұрын
let random=(max,min)=>{ return Math.round(Math.random()*100+1) } let x=random(); console.log(x) let input; while (input!=x) { input=parseInt(prompt("enter the number :")) counter++ if(input>x){ console.log("the input is greater than the orignal number"); } else if(input
@sonnecoder4008
@sonnecoder4008 Жыл бұрын
harry bhaia is playlist ko complete krne ke baad socketio pe bhi bana digeaga please 🤜🤛
@sandeepsalaria2243
@sandeepsalaria2243 Жыл бұрын
// Returns a random integer from 0 to 100: const prompt = require("prompt-sync")({ sigint: true }); let number = Math.floor(Math.random() * 101); let cnt = parseInt(); cnt = 0; let input; let score = parseInt(); while (number != input) { input = parseInt(prompt("Guess the number:")); if (number > input) { console.log("Your Guess is less than Actual number ") } else if (number < input) { console.log("Your Guess is greater than Actual number ") } cnt++; } score = 100 - cnt; console.log("Your guess is right, number is:"+number); console.log("Your score is:" + score);
@vishalagarwal1770
@vishalagarwal1770 Жыл бұрын
Hey Harry, You did a great job. And "Thanks" is very small word for all of your efforts. I believe "God Bless You" will be more apprepreate for your cpntinous endless efforts.
@bishalrout9948
@bishalrout9948 Жыл бұрын
sry harry bhai i am useing the vs code because i am more comfortable in this so answer of the question i paste it here let num = Math.random() num=num*100; num=Math.round(num) console.log(num) // let num =50; let ans='' do { ans=prompt("gause a number between 0-100") ans=parseInt(ans); if (ans < num) { alert('you given number is less than the number') }else if (ans > num) { alert('your given number is greater then the number') } } while (ans != num); alert('congratulations you win')
@shrabonisinha
@shrabonisinha Жыл бұрын
let number = Math.floor(Math.random() * 10); let chance = 0; let input; while(input!=number){ input = prompt("Enter your guess"); chance++; } console.log("The acctual number was",number,"Your score is : ",(100-chance))
@edward-soli
@edward-soli 7 ай бұрын
Buddy, This is a smart code but you forgot to tell the user about less than and greater than info...😅
@MishraPlayzYT
@MishraPlayzYT Жыл бұрын
Lovely bro
@saurabhwanjari9615
@saurabhwanjari9615 6 ай бұрын
maja aa gaya sir 🤩
@RohanDasRD
@RohanDasRD Жыл бұрын
Nice bhai
@jaidevilliers9955
@jaidevilliers9955 10 ай бұрын
Here have the answer: const magicNo = Math.floor(Math.random() * 100) + 1; let inp; let ch = 0; do{ inp = Number.parseInt(prompt("Enter the no between 1 & 100")); if(inpmNo) console.log("The entered no is greater than magic no."); ch++; }while(inp!=magicNo); console.log("Congratulation you have predicted the magic no."); console.log("Your score is "+(100-ch)); ✌✌✌✌✌
@ayoomxnu
@ayoomxnu 7 ай бұрын
let input = 0 let chance = 0 const guessed_number = Math.round(Math.random() * 100); while(input!=guessed_number){ input = Number.parseInt(prompt("Enter number between 0 to 100: ")) if (input>guessed_number){ console.log("Number is lower") } else if (input
@user-ix5bw7vt9t
@user-ix5bw7vt9t Жыл бұрын
let num = Math.floor(Math.random() * 100); console.log(num); let sum = 0; let i = 0; let a; do{ a = prompt("enter your no"); a = Number.parseInt(a); sum = sum+1; if(anum) { console.log("guess no is greater "); } else { console.log("guess no is matched "); } } while(a!=num) console.log(sum); console.log(100-sum);
@OneUploads
@OneUploads Жыл бұрын
well i remember that u gave this same question in the python exercise
@MishraPlayzYT
@MishraPlayzYT Жыл бұрын
I like your all videos
@dark-bh9cy
@dark-bh9cy Жыл бұрын
let a; let gn; let sc = 0; a = Math.floor(Math.random() * 100); console.log while(a!=gn){ gn = prompt("guess the number: "); sc+=1; if(gn>a){ alert("guess numbered is greter then number") } else if(gn
@imranhashmi5828
@imranhashmi5828 Жыл бұрын
let a=Math.floor(Math.random() * 100); let i; let count=0; while(i!=a){ let p=prompt("enter a number you guess") i=Number.parseInt(p); if(i>a) { console.log("you enter a greater number"); } if(i
@shakilakhatoon9331
@shakilakhatoon9331 Жыл бұрын
I like programming due to inside the various logics
@tirthsorthiya6320
@tirthsorthiya6320 Жыл бұрын
me to
@kamalsharma-pl9hu
@kamalsharma-pl9hu 9 ай бұрын
let num = Math.random()*101 num = Number.parseInt(num) do { var x =prompt("enter a num"); x = Number.parseInt(x); if (x>num) { console.log("is greater") } else if(x
@mixmediabysaurav3028
@mixmediabysaurav3028 10 ай бұрын
Hello Bhaiya, i am watching this just now and solved the question tell me is this correct way of my approach let x = Math.floor(Math.random() * 100) + 1; let count =0; let y; do { y=parseInt(prompt("enter your guess")); if (yx) { console.log("your number is greater"); } else{ console.log("you guess the correct number"); } count++; }while(y!==x); console.log("The guess number is ",x); console.log ("your Score is ",100-count);
@MyCodingCollege
@MyCodingCollege Жыл бұрын
const min = 10; const max = 20; let rand = Math.floor(Math.random()*(max-min+1)+min) let n, cnt=0; do{ n = prompt("Enter a Number (1 to 100): ") cnt++ if(n == rand){ console.log("Congratulations! You guessed it correct in just "+cnt+" times.") } else{ if(n
@cryptoiin
@cryptoiin Жыл бұрын
let r = Math.floor(Math.random() * 101); let inp = prompt("Enter number to guess"); let score = 100; do { if (inp > 100) { score -= 1; alert("Enter number from 1 to 100"); inp = prompt("Enter number to guess"); } } while (inp > 100); while (inp != r) { score -= 1; alert("oo ooh wrong guess"); if (inp < r) { alert("Guess higher"); } else { alert("Guess less"); } inp = prompt("Enter Again to guess"); } alert("Hey You win " + "score = " + score);
@udayansingh327
@udayansingh327 Жыл бұрын
Good initiative #HarryBhai,,challenge accepted 😅
@himeshprajapati6860
@himeshprajapati6860 Ай бұрын
const prompt = require("prompt-sync")(); let ask_num; let ran_num = Math.floor(Math.random() * 100); let score = 0; while (ask_num != ran_num) { ask_num = prompt("Enter Your Number: "); score += 1; if(ask_num < ran_num){ console.log("Enter Greater Number") } else if (ask_num > ran_num) { console.log("Enter Lesser Number") } else { console.log("Game Ended"); } } console.log("Your score is " + (100 - score));
@mr.joshi2002
@mr.joshi2002 Жыл бұрын
let x = Math.round(Math.random() * 10); let n; let count = 0; do { n = prompt("Guess the number between 1 to 10"); n = Number.parseInt(n); count++; } while (n != x); console.log("Congrats, you guess the number in " + count + " Attempt");
@prajwalkhairnar7006
@prajwalkhairnar7006 5 ай бұрын
let random = Number.parseInt(Math.random()*100); let count = 0; let guess= prompt("Guess the number"); while(guess!= random){ if(guess>random){ guess= prompt("Your guess is greater than the number, Guess the number"); }else if (guess
JavaScript in the Browser | JavaScript Tutorial in Hindi #23
10:14
CodeWithHarry
Рет қаралды 283 М.
Microsoft Girl in the US talks about AI, DSA and life in the US 🔥
21:41
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 18 МЛН
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 59 МЛН
Универ. 13 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:07:11
Комедии 2023
Рет қаралды 6 МЛН
Map, Filter & Reduce in JavaScript | JavaScript Tutorial in Hindi #20
12:49
JavaScript Operators and Expressions | JavaScript Tutorial in Hindi #6
23:26
JavaScript NUMBER GUESSING GAME ↕
8:54
Bro Code
Рет қаралды 18 М.
Walking the DOM | JavaScript Tutorial in Hindi #31
13:07
CodeWithHarry
Рет қаралды 284 М.
Project 01 Number Guessing Game in TypeScript
10:14
M Ahmed Raza
Рет қаралды 4,4 М.
Rewrite React Native App
12:14
Hitesh Choudhary
Рет қаралды 60 М.
The  Ultimate Python Programming Roadmap (Before you Start)🐍
11:39
CodeWithHarry
Рет қаралды 354 М.
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 18 МЛН