Coding A Calculator In Pure HTML CSS and JavaScript – Tutorial/SpeedCoding




In this video I code a calculator from scratch using only pure JavaScript, HTML, and CSS. No jQuery, no external libraries, no frameworks. Just plain Vanilla JS.

I do this sort of thing pretty often, and this channel revolves around tech, so if you like that kind of thing, subscribe! YouTube is hard nowadays, so I can use as many subs as possible.

Website: http://www.portexe.com/

Original source


26 responses to “Coding A Calculator In Pure HTML CSS and JavaScript – Tutorial/SpeedCoding”

  1. Great tutorial mate! Though I'm having some minor issues. The clear button doesn't seem to be working as intended, the delete button takes a few tries to work and also I can't do any calculation with two digits such as "20 + 20" or "20*20" etc… When I try to do such calculations upon pressing the equals button an error within the console pops up  "Uncaught SyntaxError: Unexpected number at HTMLDivElement.performOperation". I've done some research and tried including my code inside a window.onload function but it hasn't made a difference and also you forgot to open & close the if statement brackets within the updateDisplayVal function. Sorry for the long comment, I just wanted to provide you with as much information as possible. Thanks.

  2. I found this super helpful, as someone trying (and struggling) to learn js!
    However if I try to pass through many operators (5 + – * 5) it bugs. How would you make it only accept the last entered op?

  3. i did exactly what you did on style.css and the whole entire X column does not line up with the rest. everything else is lined up perfectly. not to mention the top half goes to the middle but the bottom half stays to the left.

  4. senpai there is a bug in the project!!!!!!!!!!!!!!!!!!!! when you enter the number more than the size of the display, the next number you enter will not appear in the display rather it hides in the overflow how to fix the issue? it is like when [000000000000] when it exceeds in the display instead to push the late number to hide the present number is the one who is hiddedn like [00000000000000] 12234 for as a latest number

  5. Hi! Great video, I really enjoyed watching how you approached this. I'm just learning HTML, CSS and JS and it's great to see the workflow of someone with experience. Just checking for those coding along: I don't believe you need to set variable names for each number (1-9) 21:44 as they are all accessed in a for loop later on.

  6. Hey, just finished your tutorial, you're an awesome teacher, pleaseee keep videos like this, i'll be looking forward to watch'em
    Cheers from Argetina
    BTW i'm subscriber #57 😀

  7. FYI: At 18:58 where you are wondering about the comma used as an decimal seperator. There are quite a few countries who use it instead of the dot (i.e. many countries in Europe like France or Germany). Maybe you have been looking at a german/french etc. calculator!
    Keep up the good work, I really liked your video!

  8. This was a great video! I really appreciated your class names since they were very descriptive and reusable. I also feel you explained everything you did in a concise and easy to understand way for people of all skill levels. I am curious why you decided to use table display instead of something like flexbox or grid. Flexbox for example would have made your styling of the 0 and AC button much easier since you could use flex-grow: 2 instead of manually typing in the widths. You earned a sub from me and I can't wait to see more of your educational content.

Leave a Reply