-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] add practice for module #34
base: master
Are you sure you want to change the base?
Conversation
got an TypeError `calc[fn] is not a function`
let oprt = ""; | ||
|
||
let publicAPI = { | ||
num, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VM29:69 Uncaught TypeError: calc[fn] is not a function
at showDisplay (:69:32)
at Array.reduce ()
at useCalc (:66:20)
at eval (eval at (new-tab-page/:1), :1:1)
at :1:1
다음 Err는 num이 원인인것 같습니다.
function useCalc
에서
var fn = keyMappings[key] || "number";
var ret = String(calc[fn](key));
fn은 숫자일때 "number"로 인자로 들어갑니다. 하지만 함수안에는 number함수대신 num이있으므로 calc[fn] is not a function이 발생하는 걸로 추측됩니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엉엉엉엉 ㅠㅠ 감사합니다.
} | ||
|
||
function eq() { | ||
if (key == "=") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1)이 조건문을 지우고
|
||
return [...keys].reduce( | ||
function showDisplay(display, key) { | ||
var fn = keyMappings[key] || "number"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2)"number"를 "num"으로 바꾸면 돌아갈 것 같습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다들 빠르게 오류 잡아주셨네요!! 👍 👍
num to number, eq() to eq(key)
got a Type Error