Tell us what’s happening:
i typed:
const calculateCalories(e) {
};
and it says im wrong
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const calculateCalories(e) {
};
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 67
toan
2
We use const
when we want to declare a variable.
calculateCalories
is a function, not a variable.
What keyword do we use when we want to declare a function?
You have to declare a function named calculateCalories.
There are two ways of declaring functions.
- First method is to use the function keyword:
function funName() {
}
- Second method is to use const keyword:
const funcName = () => {
}
You can place the parameter within the parentheses ().
system
Closed
5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.