Awesome Javascript Number Guessing Game
Вставка
- Опубліковано 26 сер 2024
- Source Code(Google Docs): docs.google.co...
Join My Discord Server: / discord
Please Subscribe if you want more videos like this: / @codingwithkenny6492
And here are the links to some of my other videos and playlists:
Calculator Playlist
• Javascript Calculator ...
Talking Computer playlist:
• I Taught My Computer H...
Dice game playlist:
• 2 Player Dice Rolling ...
To-do list playlist:
• Learn How To Build A T...
Cool video👏🏼. Can you make one that will take you to the next stage, I mean after guessing that right you should be prompted to continue to another stage of different num range let say 100-200
is Coding with Kenny available for hire??
Haha appreciate it, but what exactly do you want to hire me for? 😂😂
@@codingwithkenny6492 trying to make them have to use the paypal button before they can enter the number to see if it matches the number I put in:
Document
#container{
margin:auto;
border:7px solid Blue;
font-size:30px;
padding:10px;
text-align:center;
height:500px;
width:600px;
background-color:#0e2431;
}
p{
color:white;
}
#userInput{
width:170px;
height:23px;
}
#outputText{
color:yellow;
}
Guess The Guessing Jar Number
Enter your Guess below
Enter
Play again
var enterButton = document.getElementById('enterButton');
var againButton = document.getElementById('againButton');
var output = document.getElementById('outputText');
var Number = (1963);
function checkNumber(){
var input = document.getElementById('userInput').value;
if(input == Number){
output.innerHTML="You've Won! "+ ", "+ " it was "+ Number;
output.style.color="light green";
}
else if(input>Number && input
Thank you very much
Thanks for the excellent video!
Anyone knows how could I add an iteration that would count how many guesses the user took to find the number? Thanks again
Appreciate your feedback, Eduardo! Yeah there is a way you can code up the functionality to make that work. If you have any trouble, let me know and I'll take a look at it.
Cool video! I was just wondering, if you wrote a hardcoded number instead of random number, how do you hide it from the source code in dev tools? Cause then anybody could go to the dev tools and see what the correct number is (I'm new to programming). or in the dev tools if somebody went to the js file and wrote input == 7 and then they submit 7 they get the correct answer how do you prevent that from happening? Is it possible to hide that logic?
Hey, thanks for reaching out!
I'm not exactly sure yet, but I've tried doing what you were saying by building a react project and then going to the dev tools or doing CTRL + U, and it was able to hide the code from other people so I think using React might be helpful. However though, since you are new to programming, my advice for you would be to learn the fundamentals of javascript and then use what you learned to start building a TON of projects....and when I say a TON... I mean it Lol... I've spent most of this year building projects and then posting them onto my UA-cam Channel. Practice and repetition is key when it comes to learning programming(I still have a lot more to learn)
But for now, since you're a beginner, you don't have to worry about anyone seeing your code since it's going to be local, meaning that only you can see it on your computer and no one else, even if you sent them the link to your project because it's not deployed yet so the link won't be valid. Hope I was able to help you. Let me know if you have any other questions or concerns!
Thanks so much for the advice! I will look into react! You see right now I am learning Angular, and using angular you still see the correct number in the dev tools. And i have to say i'm not a completely new beginner, theres just random stuff i think about that i cant find the answer too hahah. but I will look into react! :) Thanks!
@@skrazzy Haha that's awesome thought that you already know a little about angular. I might also consider learning that next year since I just started learning react very recently and still need to get comfortable with the core concepts and syntax! Good luck on your coding journey!
@@codingwithkenny6492 Good luck to you too and your UA-cam channel! :)
Nice. How can we implement enter key from the keyboard along with the screen button? Thanks
Great idea! We can implement the logic for the enter key by creating an if statement to check the keycode of the key that is pressed and if it is equal to 13 which is the keycode for the enter key, then we can have it run the same function and it'll work the same way as the button.
Thankyo soo much mean alot
You're welcome! Like and subscribe if you enjoyed!
How would you code so that the input is set for 7 tries only?
You could create a variable called "limit" or something like that and set it to however many tries the user is allowed to have. Then after that, write a few conditional statements dictating that when the "limit" variable hits 0, alert("Game over. You lost") or something like that. I could reupload this video with your suggestion if you want to see how you could go about solving this problem:)
will this work if i write the code in notepad?
Nnnnnoiiiice video
Thankkks!!!! Appreciate it, glad you like it! 😁
Thanks soo much
You're welcome! Feel free to subscribe for more content!