i'm learning to code and built this game during the last few days but my solution it's so clumsy compared to yours.. thank you for sharing this, is very helpful to learn, your solution is amazing!
@richardchimama8807 Жыл бұрын
I have learned a lot in a few minutes. Thank you!
@ShimmerBodyCream11 ай бұрын
Thank you for including the code in the comment! I had my HTML filed messed up. Thank you for sharing your project with us.
@pedrocossio9462 Жыл бұрын
You have saved my life made understanding Javascript a bit easier for me
@mycreations45 Жыл бұрын
😮😮
@santiagovalle450 Жыл бұрын
BROOO thankyou so much, this really helped and the tutorial was really easy to use as well :)
@fasteditsyt Жыл бұрын
Yo Bro Code! Thanks for this play along video. I learned some new things along the way!
@qqszad2 жыл бұрын
bro your videos help so much. thank 10/10
@RyanDoi Жыл бұрын
I love this guy
@samoraselim63382 ай бұрын
Thanx for your simplicity ,tried to do this game using another video was difficult, too much code lines Thank you for including the code in the comment😍
@saiyyaaratrading4432 Жыл бұрын
after the end of the match, cant we add any other tag for sharing our result with others in social media apps?
@charlestiffany65334 ай бұрын
since we are not saving anything in any kind of storage we can just just do this function restartGame(){ location.reload(); }; to reset the game. im pretty new to js so maybe theres a good reason bro didnt do this but it does work.
@ashwinr8317 Жыл бұрын
please upload a Zero to hero video for wordpress bro ! the way of your teaching was just amazing accept my request bro 😫🙏.
@noyaaa1904 Жыл бұрын
hey, i have a question. Do you maybe have the code just in Pyscript?
@faiqchanel5001 Жыл бұрын
Thanks for help love you bro
@dragomirpetrov56002 жыл бұрын
Are any of these available in Java, or should I just mod it 🤔
@lautaroscolamiero83847 ай бұрын
Nice code man thanks!
@user-ve4to6yi5v Жыл бұрын
thanks, alot of help.
@cnox9102 жыл бұрын
Continue dude'
@radhikaiyer4119 Жыл бұрын
excellent
@noahnyman4420 Жыл бұрын
underrated
@sanathrayala27452 жыл бұрын
Great video Also do a video on todo list
@lucabinder9829 Жыл бұрын
🔥
@CoriePrater2 ай бұрын
Thank you for the learning experience! Is there a way to change the X and O's to an image? Would I have to stare the image in a variable? Thank you again!
Uhh can i ask something Does any reason for you not using onclick or you just not want use it ?
@travel_horizen9 ай бұрын
using addEventListener makes the code look more maintained and readable plus easy
@yashu_vocalist11 ай бұрын
08:35 is hoisting of the 1st function.
@abdullahjama84044 ай бұрын
easy loved it except the last part thats the wining game foreach with some and every method can run through the global variable winning condition, otherwise loved it, wish u implemented some Ai too , amazing and very clean code , can u talk about writing clean code?
@rajat-s-kale17712 жыл бұрын
Awesome
@samifly275310 ай бұрын
👍
@user-lq3bm4zp3x5 ай бұрын
bro my tic tac is showing on the website but, all the gaps were autofilled, even the restart buttons are not working.So i checked my whole code,but there is no mistake.how to solve this problem.Any suggetions pls?
@ehidaniel2498 Жыл бұрын
please why did you pass in this and cellIndex as arguments in the updateCell() function under the cellClicked() function 🙂
@izikki11499 Жыл бұрын
How I understand it: Pretty much, THIS is referring to the cell you just clicked (THIS one), And the cellIndex comes from the HTML elements we made for the cells, we made that attribute named ‘cellIndex’ and gave it a number for what cell it is in our options[ ] array Pretty much, you pass those in to the updateCell( ) and it updates whatever cell you clicked on(THIS), by setting its text content to whatever the current player is (x or o) and uses the cell index attribute to update the options [] array, where all our cells are which are empty to start with Hope I explained it okay :-P
@michaellariosa340622 күн бұрын
It tells the updateCell function which cell to change the textContent for. You're passing it as 'this', calling it 'cell' in the updateCell function, and then updating the text of it via cell.textContent = currentPlayer. He could have done the update of the text and the addition of the clicked sell to the options array in the cellClicked function, but to keep it clean, he did it as a separate function and just passed it along. like this: function cellClicked () { const cellIndex = this.getAttribute("cellIndex") console.log(this) if (options[cellIndex] != "" || !running){ return; } options[cellIndex] = player; this.textContent = player; checkWinner(); }
@radhikaiyer4119 Жыл бұрын
eccellent
@Youss02 Жыл бұрын
hey bro, can you help me? i copied your css like in the video , but the scare wont place as i wanted can you help me? srry for my bad english
@Youss02 Жыл бұрын
square*
@uchennafelix3829 Жыл бұрын
Sir, is it possible to change the color of the "X" and the "O" I mean "X" can be red and the other green
@travel_horizen9 ай бұрын
Yes its actually possible you can do it with css
@MeowKiritoMeow8 ай бұрын
just go to the cell class and change the color attribute
I tried coping your code words for words but it didn’t work
@Kaylebsyoutube9 күн бұрын
It won’t let me actually play it I tried and copied all of the stuff but it doesn’t work the text, button is there but not working, and board is good though (no errors in vscode though)
@irawadeep.6607 Жыл бұрын
Hi, I find some error when the game end and got the winner. The current winner is not match with the result ex. the "X" win but it display "O" win. Is there any suggestion to fix that please?
@user-mf2ov2dn5q9 ай бұрын
Im facing the same problem! Did u fix it?
@irawadeep.66079 ай бұрын
@@user-mf2ov2dn5q no, not yet🥹
@hillarymapondera41224 ай бұрын
Hi @@user-mf2ov2dn5q I noticed the same issue in my code however I managed to fix the issue. What I understood was that suppose currentPlayer === "X" it means "X" is about to make his move and if "X" wins because of the order our functions are being called the changePlayer() function is called first before Checkwinner() function thus making the currentPlayer === "0" as a result when we display the winner if we use the currentPlayer variable it will be "0" thus it will be the opposite of the true winner. so to Fix this issue before displaying who the winner is, I reversed the current player as follows winner = (currentPlayer === "X") ? "O": "X"; and then display the winner on winning statusText. hope its gonna be helpful :)
@gamerfx685 Жыл бұрын
am stuck at status text it says handwork.html:71 Uncaught TypeError: Cannot set properties of null (setting 'textContent') at initializeGame
@travel_horizen9 ай бұрын
The error message you're encountering, "Uncaught TypeError: Cannot set properties of null (setting 'textContent')" typically indicates that you are trying to set the textContent property of a variable that is currently null. This can happen when you're trying to manipulate an element in your HTML document using JavaScript, but the element with the specified identifier doesn't exist in the DOM.
@RtzVi_ Жыл бұрын
I am new in the code things so I have a question. After I made the game how can I see the game like he sees it in the right of the screen
@kubitte Жыл бұрын
If you are using visual studio code, download ''live server'' extension. Then go to your html file and right click and select ''open with live server''.
@rainbowpizza7599 Жыл бұрын
Open two tabs simultaneously side-by-side, the editor where you code and the browser where it displays. Change the code and refresh after every save or install the live server extension 🥂
@rahulchaudhary3508 Жыл бұрын
I'm getting a type error saying this.getAttribute is not a method, any help?
@ziga1998 Жыл бұрын
Remove the cellClicked function, and write the code directly inside cell.addEventListener().. Like this cells.forEach((cell) => cell.addEventListener("click", (e) => { const cellIndex = e.target.getAttribute("cellIndex"); console.log(cellIndex); if (options[cellIndex] != "" || !running) { return; } updateCell(e.target, cellIndex); changePlayer(); checkWinner(); }) );
@fireworkcat778610 ай бұрын
game stops working after one win, gonna try and fix that
@ji_nvnc4113 Жыл бұрын
when I click on the restartBtn I can't replay, does someone has an idea ?
@recursion. Жыл бұрын
post your code it's prob some error somehwere
@joyceasante8292 Жыл бұрын
For anyone who has the same issue, check to see if you made a typo in your code. The reason why my code was not working is because I wrote "#restartBn" instead of "#restartBtn".
@wlw113 Жыл бұрын
I have error at 25 line restartBtn.addEventListener is not a function. Pls help
@Megapolis199 Жыл бұрын
Same shit for restartBtn. Cannot read properties of null (reading 'addEventListener')
@artenisalija Жыл бұрын
you need to put the script tag after the HTML in the index.html and make sure you have used # when declaring the const and the right id. this solved it for me.
@artenisalija Жыл бұрын
@@Megapolis199 you need to put the script tag after the HTML in the index.html and make sure you have used # when declaring the const and the right id. this solved it for me.
@michaellariosa340622 күн бұрын
@@artenisalija or put it at the beginning and use "defer".. like this:
@bodyaoliynik23502 жыл бұрын
Please someone give me advise.How I can won't forget what I learned?
@BenDover-qr3ib11 ай бұрын
do it over and but like in the sort of a project
@travel_horizen9 ай бұрын
Practice
@nivethashankar82217 ай бұрын
RestartGame is not a function. Pls help
@michaellariosa340622 күн бұрын
lowercase "r"
@emersonperalesvillanueva8568 Жыл бұрын
and the code in github? xd
@user-wy2hn8ul6b Жыл бұрын
Didn’t work😢
@supreme-soft Жыл бұрын
Instead of just writing code in bullet speed please do some explanation as well my Big Bro 💝.
@JustinUltamit4 күн бұрын
random comment random comment
@linelaine35972 жыл бұрын
why it did not word at “ restartBtn.addEventListener(“click”, resetGame); ”😢
@dhiyanabdurazack5257 Жыл бұрын
it is onclick
@fazrikurniawan9643 Жыл бұрын
Go back to index js, ensure that cons no 2 & 3 "document.queryselector" not "document.queryselectorAll"
@artenisalija Жыл бұрын
you need to put the script tag after the HTML in the index.html and make sure you have used # when declaring the const and the right id. this solved it for me.
@yushgisor2125Ай бұрын
i did it like this ,document.getElementById("restartBtn").onclick = restartGame();