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

JS calculator... Help!

Can someone explain to me how can I get the corect number from the button and then the value of the operation? (+, × etc)

2nd Feb 2020, 8:17 AM
Hagl Official
Hagl Official - avatar
8 Answers
+ 1
I'm coming back to check your progress. Have you read the materials?
3rd Feb 2020, 6:00 AM
Gordon
Gordon - avatar
+ 2
1. Explanation You have a large margin-left of 400px for your #scene, 1.1 when viewing on a computer with 1920px width, this 400px left margin puts the calculator in center. 1.2 when viewing on a mobile with about 300px width, you have to scroll right to see the calculator. 2. Here is some learning materials: 2.1. Use viewport unit vw: https://code.sololearn.com/WrgbrFC038ma/?ref=app 2.2. Centering element with flexbox: https://www.sololearn.com/post/37760/?ref=app https://code.sololearn.com/WnNWl3XiEd84/?ref=app https://code.sololearn.com/W51CLpHyrWy0/?ref=app 2.3. Another tutorial series suitable for you - Responsive Centered Square https://code.sololearn.com/W593ZCiu560u/?ref=app 3. In case you can't work it out, here is a fix:
2nd Feb 2020, 11:47 AM
Gordon
Gordon - avatar
+ 1
https://code.sololearn.com/W2f0bV88rCdy/?ref=app I copyed and paste from my PC Idk why i dont have an output here... anyway i guess its ok
2nd Feb 2020, 8:59 AM
Hagl Official
Hagl Official - avatar
+ 1
that's what you should know! now, i don't want to show you the fixed version. please read the above and try to rebuild the UI. Hint : don't position each button by hardcoding top and left, because it is not responsive. Redo HTML structure, build the container first, position it in center, create two children of container, one for upper part, one for lower part, all buttons should be children of lower children of container.
2nd Feb 2020, 11:57 AM
Gordon
Gordon - avatar
0
Can you show us your code?
2nd Feb 2020, 8:47 AM
HonFu
HonFu - avatar
0
Rune Official: that's because of your css. Try to remove all css and you will see!
2nd Feb 2020, 10:41 AM
Thống Nguyễn
Thống Nguyễn - avatar
0
That is not what i want to know... I wanna know how can I get the corect output for ea button in the calculator
2nd Feb 2020, 11:51 AM
Hagl Official
Hagl Official - avatar
0
Kinda
4th Feb 2020, 5:38 PM
Hagl Official
Hagl Official - avatar