Thank you! This has made JavaScript make sense! I just finished the free code camp module and my brain ached a little, but now I've put it into a project, it's easier to understand! Thank you! :D
Hi, Thanks for your tutorial, I was wondering how it would be possible to add spaces to the wordStatus? at the moment if a space is added it renders as an underscore, how do you make it a space? for example 'star wars' shows 9 underscores, I would like it to have 4 underscores followed by a space, then another 4 underscores with the space automatically "guessed"
Hey found you through a comment on one of my videos. Good luck making programming tutorials. I would suggest updating your channel description since it's not really relevant.
Hi wait @Simon Suh I know you won't see this, but please can you tell me how I can change the hangman images into heart lives. I have seen that you do a new image for each seperate wrong letter, yet I want to change them into hearts. I have these images, called: 1 Life.png 2 Lives.png 3 Lives.png 4 Lives.png 5 Lives.png 6 Lives.png At first, wherever I have got an 'images/0.jpg' I replaced it with 'images/6 Lives.png'. And after I did a search on VS for any other 'images/...' but I found nothing more. It shows my image normally, the one with 6 Lives, but as soon as I press the wrong letter, it disappears, rather than showing the 5 Lives image, and when I press the right letter, it stays there as it is. Any ideas on how I can solve this problem?
I figured this out. You would create a function and create an array inside that function, this is what mine looks like: function giveHint () { var hints = [your hints go in here, separated by commas (make sure they're listed in the same order as the words in your words array)] var hintIndex = words.indexOf(answer); window.alert (hints [hintIndex]); I chose to display mine in an alert box but how you do it is up to you. Hope this helps!
This is a fantastic tutorial because of the step-by-step approach, along with the provided code (which is super clean). Thank you so much for creating this. (Referring to you code posted on Github) My questions are: Why do the letter buttons populate above the reset button in the DOM? How does that happen, even though the reset button was created first, and the JavaScript is loaded after the HTML because of its placement before the ending body tag? In line 25, why does omitting the "let" keyword before "answer" mess up the function? Isn't "answer" a variable? Finally, how do you get your images to reload? I added my own images, from a folder, named them the same, after the first guess the image disappears. Thanks again for a great video.
I dont understand why if you declared let wordStasus = null; and then you wrote: document.getElementById('wordSpotlight').innerHTML = wordStatus; still works?! It was a misspell wordStasus vs wordStatus at 19:10 and 21:02
You're right, I'm not sure why it's not popping up as an error immediately. But the variable wordStatus does get defined shortly after so I think code wise it should be fine.
Thank you! This has made JavaScript make sense! I just finished the free code camp module and my brain ached a little, but now I've put it into a project, it's easier to understand! Thank you! :D
Really good tutorial, I liked the fact that you left in the mistakes and debugging process.
Hi, Thanks for your tutorial, I was wondering how it would be possible to add spaces to the wordStatus? at the moment if a space is added it renders as an underscore, how do you make it a space? for example 'star wars' shows 9 underscores, I would like it to have 4 underscores followed by a space, then another 4 underscores with the space automatically "guessed"
How can I add an alert on the page of the messages "you won or "you lost" with audio with losing and winning audio? using your tutorial?
Thanks, i'm learning a lot
Hey found you through a comment on one of my videos. Good luck making programming tutorials. I would suggest updating your channel description since it's not really relevant.
ty, done.
The function generateButtons doesn't work on my end. i get the uncaught typeerror document.getElementById (...) is null in the console
Hi wait @Simon Suh I know you won't see this, but please can you tell me how I can change the hangman images into heart lives. I have seen that you do a new image for each seperate wrong letter, yet I want to change them into hearts. I have these images, called:
1 Life.png
2 Lives.png
3 Lives.png
4 Lives.png
5 Lives.png
6 Lives.png
At first, wherever I have got an 'images/0.jpg' I replaced it with 'images/6 Lives.png'. And after I did a search on VS for any other 'images/...' but I found nothing more. It shows my image normally, the one with 6 Lives, but as soon as I press the wrong letter, it disappears, rather than showing the 5 Lives image, and when I press the right letter, it stays there as it is.
Any ideas on how I can solve this problem?
Oh Sorry Don't Worry I've solved my problem. I guess I should try a couple of times before I ask question - I got it now.
Great work. But didn't understand what's happening in function "guessed word()". Can someone help?
Simon, how would you add a "hint"" option here? is it too difficult?
I figured this out. You would create a function and create an array inside that function, this is what mine looks like:
function giveHint () {
var hints = [your hints go in here, separated by commas (make sure they're listed in the same order as the words in your words array)]
var hintIndex = words.indexOf(answer);
window.alert (hints [hintIndex]);
I chose to display mine in an alert box but how you do it is up to you. Hope this helps!
This is a fantastic tutorial because of the step-by-step approach, along with the provided code (which is super clean). Thank you so much for creating this.
(Referring to you code posted on Github)
My questions are:
Why do the letter buttons populate above the reset button in the DOM? How does that happen, even though the reset button was created first, and the JavaScript is loaded after the HTML because of its placement before the ending body tag?
In line 25, why does omitting the "let" keyword before "answer" mess up the function? Isn't "answer" a variable?
Finally, how do you get your images to reload?
I added my own images, from a folder, named them the same, after the first guess the image disappears.
Thanks again for a great video.
How do I make this but with a prompt that ask for a person to enter a word? And we need to try to find this word?
hi, how can I do if I can copy the code but I do not understand what I am writing?
any suggestion=?
Thanks for video.
thanks man!
How download that first images
With this many ads every couple of minutes, you should be paying us to watch this video!!
I dont understand why if you declared let wordStasus = null; and then you wrote: document.getElementById('wordSpotlight').innerHTML = wordStatus; still works?! It was a misspell wordStasus vs wordStatus at 19:10 and 21:02
You're right, I'm not sure why it's not popping up as an error immediately. But the variable wordStatus does get defined shortly after so I think code wise it should be fine.
@@SimonSuh Thank you. Really nice work! It helped me a lot to understand JS
Hi Simon, I followed your steps by detail but the word doesnt seem to be randomizing for some reason. Any ideas? would be really helpful
Nvm Simon I got it to work, YOU THE BEST THO!!!!
@@IROCKINSNIPING how did u fix the getElementbyId.setAttribute part plz ?
Hi Mr Simon may i request that you make a new version of this hangman javascript and send it to me personally i really need this for my school work
^^
its not vanilla js if theres html....
Youwas thinking a lot during the video and it is a very bad habit for your teaching !
How can I change this into a text-based program?
You could change the updateHangmanPicture() function to refer to a text based layout instead of a image based one.