调用和调用函数之间有区别吗?

时间:2019-06-05 09:54:57

标签: javascript

我在执行以下说明时遇到了麻烦

At this point, letsCalculateBMI is ready to claculate the user's BMI. It should do this by calling computeBMI and passing it user. 

It then sets the return value from invoking computeBMI to a bmi variable, which is finally set as the text content of the PARAGRAPH within the #outcome DIV

我尝试了不同的可能性,但是尽管应用返回的结果是正确的,但是测试运行程序却无法通过。

我正在构建一个应用程序,这是最后一个用户故事。这是我尝试过的:

const computeBMI = ({weight, height, country}) => {

        const convertedHeight = height * 0.3048;
        let bmi = (weight / convertedHeight * convertedHeight);

        if (healthiestCountries.includes(country)) bmi *= 0.82;

        //document.querySelector('#outcome p').innerHTML = bmi;

        return bmi;        
        };

      const letsCalculateBMI = () => {
        const value = document.querySelector('.select-text').value;
        const user = getSelectedUser(value);
        //computeBMI(user);
        const bmi = computeBMI(user);

        document.querySelector('#outcome p').innerHTML = bmi;
        console.log(user)
      };

根据上面的说明,您认为我的实现遗漏了什么吗?调用和调用函数有什么区别?

0 个答案:

没有答案