calculator in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

calculator in js

I want to write a program, when I press button the value button should appear in input field. Like if press 1 the input show 1 similart 2,3 and so one, likewise in a calculator. So what would be the code of area.addEventListener function. Html code <div> <input class="area" type="number"> </div> <div> <button class="one">1</button> <button class="two">2</button> <button class="three">3</button> <button class="four">4</button> </div> JavaScript code const area = document.querySelector(".area"); const b1 = document.querySelector(".one"); const b2 = document.querySelector(".two"); const b3 = document.querySelector(".three"); const b4 = document.querySelector(".four"); area.addEventListener("click", function(){ });

1st May 2018, 12:42 PM
Abdul Basit
Abdul Basit - avatar
1 Answer
+ 3
it is nice and even cool. I liked it. but I think some more animations and designs should be added to make more attractive. but even it is nice.
1st May 2018, 4:05 PM
keev23i
keev23i - avatar