I was trying to code a simple calculator. But how can i get value evaluated when i press buttons and they could be seen in res? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I was trying to code a simple calculator. But how can i get value evaluated when i press buttons and they could be seen in res?

28th May 2020, 6:47 AM
Ravi Pratap
Ravi Pratap - avatar
2 Answers
+ 2
You have to write a function and use it on "onclick" event of button. Example: //Html <button onclick="myFunc()">Click me</button> //Js function myFunc() { console.log("You clicked me.."); }
28th May 2020, 6:55 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Bro you see my first post . There I had made a simple calculator you can see.
28th May 2020, 12:09 PM
Dinesh Kuniyal
Dinesh Kuniyal - avatar