JavaScript bertenaga kalkulator

Aku bosan (dan kalkulator saya keluar dari baterai), jadi kupikir aku akan mengambil celah untuk mengembangkan kalkulator berbasis web. (You can find it at hathix.com/etc/calculator. Pada dasarnya, Anda dapat memasukkan beberapa perintah (deklarasi variabel atau fungsi panggilan) dan kalkulator akan menggunakan kekuatan JavaScript untuk menemukan jawabannya.

The neatest thing about the calculator is that it has some built-in functions (anything from finding a number’s square root to finding the LCM of two numbers to finding the solutions to a quadratic equation.)

Here are some commands you can enter into the calculator and what they do:

Command what it does

  • cheese = 42 creates a variable called cheese with the value 42.
  • 5 + cheeseshows 47 (although cheese is still 42.)
  • sqrt(cheese+7) finds the square root of 49, which is 7.
  • gcd(32,40) – finds the greatest common denominator of the numbers (in this case, 8.)
  • quadratic(1,6,8) finds the roots of the quadratic equation x2 + 6x + 8 = 0 (they’re -2 dan -4.)
  • google(“uzbekistan”) – it’s not math-related, but it does a Google search on Uzbekistan.

I’m still adding more functions/libraries to the calculator, so if you want to help let me know.

Diterbitkan oleh

Neel Mehta

Harvard College. Pengembang web. Kadang filsuf. Baseball junkie.

Tinggalkan Balasan