我正在学习编码,这只是一个练习。任何导致负数的操作都会显示错误,但console.logs会显示正确。\n这是为什么?
\n<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width">\n <title>replit</title>\n<style>\n\n#calculator{\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n max-width:400px;\n min-width: 300px;\n background-color: green;\n}\n\n#screen{\n width: 100%; \n aspect-ratio: 4/1.5;\n background-color: rgba(0, 0, 0, 0.8);\n}\n\n#input{\n width:90%;\n height:90%;\n background-color:rgba(0, 0, 0, 0); \n color:white;\n font-size: 15vw;\n direction: rtl;\n font-family: Helvetica, sans-serif;\n}\n\n#buttonsGrid{\n width: 100%;\n aspect-ratio: 4/5;\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n grid-template-rows: repeat(5, 1fr);\n justify-content: center;\n font-size: 5vw;\n color:white;\n background-color: gray;\n font-family: Helvetica, sans-serif;\n}\n\n.singleButton{\n border: solid;\n border-color: black;\n border-width: 1px;\n display: flex;\n align-items: center;\n …Run Code Online (Sandbox Code Playgroud)