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

js-HW #33

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

js-HW #33

wants to merge 2 commits into from

Conversation

YenChia-Lai
Copy link

No description provided.

else if(bmi>24){
message='過重' }
else{
message='正常'}
Copy link

Choose a reason for hiding this comment

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

13~18行應該放到getMessage函式中判斷,每個判斷都要return一個訊息,例如:

if(bmi<18.5){
    return "過輕";
}

}
console.log(getBMI(1.88, 74));
// getMessage
var message ;
Copy link

Choose a reason for hiding this comment

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

如果已經有用return就可以不用再透過message存訊息了。

// getMessage
var message ;
function getMessage(height, weight){
return weight/(height*height);
Copy link

Choose a reason for hiding this comment

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

如果是寫這樣的話,getMessage函式不就跟getBMI功能一樣了?

function getMessage(height, weight){
return weight/(height*height);
}
var bmi= getMessage(1.7,74)
Copy link

@Evafly Evafly Aug 4, 2017

Choose a reason for hiding this comment

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

直接bmi=getBMI(height,weight);取得BMI值就好,

message='過重' }
else{
message='正常'}
console.log(message); //
Copy link

@Evafly Evafly Aug 4, 2017

Choose a reason for hiding this comment

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

console.log(getMessage(1.7,74));印出函式結果就可以了

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

Successfully merging this pull request may close these issues.

2 participants