15: Exercises in JavaScript | Create a Calculator Using JavaScript | JavaScript Tutorial | mmtuts

Exercises in JavaScript | Create a Calculator Using JavaScript | JavaScript Tutorial | mmtuts. In this JavaScript tutorial you will create your first JavaScript exercise. The exercise will be building a calculator using JavaScript which is a very good and simply project to start out with.


First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful 🙂

Material for this lesson: https://www.patreon.com/posts/javascript-15-18708464


Ezeanyika Victor says:

And it reads

RundErr24 says:

What would happened if we set input type =”number” in our form? Would be output string as well? Thank you for your videos 🙂

Learning Simplified says:

Great topic to discuss. wonderful presentation…

raiser.js says:

can you help me about “calc is not defined in HTML” cant get to work i just follwed the code. TNX!

Obito Uchiha says:

Is styling the calculator important for practice ?

jakub klos says:

Perfectly explained!! Thanks !!!

TheLoGgIDK says:

Why do you use querySeletor if you are still gonna put id’s on items. Why not use getElementBtID? Good Video!

Tae Yo says:

thank you for the lesson, but i have a problem .. when i give the calculator the values then press calculate button it show the result for a second and then disappear .. how to solve it?

Gels_YT says:

Hey sir instead of document.querySelector(“#id”).value; we can also use
document.getElementById().value right? 😀 just askin if it’s okay 😀 thanks..

Omni says:

You should talk about Event Listeners

chris marokhu says:

what is the name of the ide or editor you are using?

eatyourgarden australia says:

I thumbs up before i even watch. Your a legend 🙂

Trivedi Dhaval says:

In my project I’m using jQuery.. but when I use external js file. I am getting an error that says “$ not defined” and whenever I use the same code internally I don’t get single error. Can you tell me why is this happening?

Happy Shah says:

Great explanatioN!

Via Nashwan says:

you are amazing ! your voice so clear or simple , you are a best , you teacher , you my soul , you good , thank u thank u thank u …….

Ankit Jindal says:

do u have courses on udemy

Matt Smith says:

I’m at 15:39 of the video. when I console.log(calculate) I get this; Uncaught ReferenceError: calc is not defined at HTMLButtonElement.onclick (index.html:22). I have tried to resolve this but to no avail. index.html:22 reads;

Ezeanyika Victor says:

Anytime I Write calculate, it says Uncaught ReferenceError: calc is not defined
at HTMLButtonElement.onclick (index.html:21)

Practice customize wordpress theme says:

great video

akashjit nayak says:

Awesome Explanation sir

陈瀚龙 says:

I got excited and just popped in on this video first. I thought var was done. Const. Let. ES6. Awesome.

Ann Macuha says:

What’s the difference between querySelector and getElementById?

Shwoop DaCobra says:

So I want this to work but I am coming across an issue I can’t seem to find the answer to:
Refused to execute script from ‘’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.

This keeps happening whenever I try to calculate. On top of that, however, this is happening:
Failed to load resource: the server responded with a status of 404 (Not Found)

I followed the video down to the character so I’m confused where I went wrong. Curious if anyone has a solution

Yu-Jyun Lin says:

I keep getting NaN error but I follow exactly the same step as you do, why ? T.T

AnG10287 says:

you have also long hair i have too looking good….anyway thank you for the video

saqib omari says:

Can we use parsechar for op veriable or is there a method to get only characters?

jeypi Dela Cruz says:

how is your browser updating even ur not refreshing? kinda cool tho, teach us to set it up like yours

Enoch Hagan says:

Great thanks

Nelson Paixão Pinto says:

Hello daniel, is there a site where i can see the pat socket besides my public ip? You often show that in the videos

0x10 says:

I have the same hair length as you lol

FlyingGamess says:

Can you make a working adminpanel that using your php login system i cant find one on youtube

NERO says:

i agree that the calculator has almost all of the concept in programming. displaying at inputting data not the normal cal i am expecting but the still simple. instead of using document.getElementByID(‘ ‘) you are using the document.querySelector(“#”) am i right that they are the doing the same way or am i wrong?

Stoney_Eagle says:

Learn every time. I kinda wanna know how to make a html js video player that can play YouTube, Daily motion, mp4 and live streams with closed caption styling in css that looks like YouTube’s player. .

Tech Expert says:

thanks thanks thanks

BC Modak says:

Hello dear, I am from Bangladesh. Why my calculator need refresh every time, for calculating a new one? It only works once. Is there any way to solve this?

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!