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

[p:78] 코드 문의? #20

Open
GimYoungPhil opened this issue Sep 21, 2018 · 1 comment
Open

[p:78] 코드 문의? #20

GimYoungPhil opened this issue Sep 21, 2018 · 1 comment

Comments

@GimYoungPhil
Copy link

GimYoungPhil commented Sep 21, 2018

// 표준 체중과 비만도를 계산하는 함수
function logic(height, mass, gender) {
  let broca = (height - (gender === "male" ? 100 : 105)) * 0.9;
  let bmi = height / 100 * height / 100 * (gender === "male" ? 22 : 21);
  if (gender == "male") {
    broca = (height - 100 * 0.9).toFixed(2);
    bmi = (height / 100 * height / 100 * 22).toFixed(2);
  } else {
    broca = (height - 100 * 0.9).toFixed(2);
    bmi = (height / 100 * height / 100 * 21).toFixed(2);
  }

  ...
}

78 페이지 코드에서 broca, bmi 변수값을 구하는 과정에서 분기문을 제거하려는 의도로 보였는데 다시 분기문이 추가 된거 같습니다. 아래와 같이 변경하면 어떨까요?
확인 부탁 드립니다.

// 표준 체중과 비만도를 계산하는 함수
function logic(height, mass, gender) {
  const broca = ((height - (gender === 'male' ? 100 : 105)) * 0.9).toFixed(2);
  const bmi = (height / 100 * height / 100 * (gender === 'male' ? 22 : 21)).toFixed(2);

  ...
}
@sculove
Copy link
Owner

sculove commented Sep 29, 2018

@GimYoungPhil 감사합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants