Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

[FEAT] add practice for module #34

wants to merge 3 commits into from

Conversation

nKiNk
Copy link
Collaborator

@nKiNk nKiNk commented Jan 17, 2021

got a Type Error

VM29:69 Uncaught TypeError: calc[fn] is not a function
    at showDisplay (<anonymous>:69:32)
    at Array.reduce (<anonymous>)
    at useCalc (<anonymous>:66:20)
    at eval (eval at <anonymous> (new-tab-page/:1), <anonymous>:1:1)
    at <anonymous>:1:1

@nKiNk nKiNk added help wanted 도움이 필요함 practice 책 부록에 있는 연습문제에 관련됨 labels Jan 17, 2021
@nKiNk nKiNk self-assigned this Jan 17, 2021
let oprt = "";

let publicAPI = {
num,
Copy link
Member

@hochan222 hochan222 Jan 17, 2021

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이 발생하는 걸로 추측됩니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엉엉엉엉 ㅠㅠ 감사합니다.

}

function eq() {
if (key == "=") {
Copy link
Collaborator

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";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(2)"number"를 "num"으로 바꾸면 돌아갈 것 같습니다!!

Copy link
Collaborator

@pje1740 pje1740 left a 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)
@igy95 igy95 removed their request for review May 16, 2021 13:00
@yujo11 yujo11 removed their request for review August 19, 2021 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted 도움이 필요함 practice 책 부록에 있는 연습문제에 관련됨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants