Javascript Tutorial 2 - Making a Basic Calculator

preview_player
Показать описание
In this tutorial I show you how to make a very basic calculator, this uses many aspects of javascripts, and provides a good starter package of information for any one that is interested in what javascript can do. On that note, this is the absolue basics of what JS can do. Enjoy there is more to come.
Рекомендации по теме
Комментарии
Автор

This helped me with my finals :D thanks a lot!!

hampus.jerkfelt
Автор

Followed your instructions step by step and it works! thanks for posting this!

Nickdee
Автор

Great video, very informative. I had a simple question: How do you set the number of decimal places displayed? Thanks in advance. 

kmr
Автор

I'm curious about the hoisting of vars `num1`, `num2`, and `sign` at the top of the code. They are all just local variables of child functions. Why does the parent function need to know about them?

annerichardson
Автор

u should use html entities for the ×÷ signs

MrMaestro
Автор

Once created the app, how to upload it as build-in function to my website ?

tedahd
Автор

For those who are having problems a lighter and working script:

function calc() {
  
num1 =
num2 =
sign =



if(sign == "*"){

= +num1 * +num2;

}else if(sign == "/"){

= +num1 / +num2;

}else if(sign == "-"){

= +num1 - +num2;

}else{

= +num1 + +num2;

}


}

TheMatteoCorona
Автор

Hey man im getting an error when i calculate it says in the console that calc is not defined please help me man :D

AvecyTunez
Автор

got it to work forgot the doCalc(); at the end

dkapper
Автор

I met the same problem. could u tell me the solution?

joyceyan