Return 1 exercise error


#1

https://www.codecademy.com/courses/learn-javascript-functions/lessons/functions/exercises/return?action=lesson_resume&course_redirect=introduction-to-javascript

The console says i’ve done the exercise right, but that exercise is supposed to return a number (3) multiplied by a price (7.5), but it returns a 0.
What’s the problem in the code? and why does the console consider the exercise good?

```

let orderCount=0

const takeOrder=(orderCount= orderCount + 1, topping, crustType)=>{
console.log('Order: '+ crustType + ’ pizza topped with ’ + topping)
};

const getSubTotal=(itemCount)=>{
return (itemCount*7.5)
}

takeOrder(‘bacon’, ‘thin crust’)
takeOrder(‘potatoes’, ‘thick crust’)
takeOrder(‘mushrooms’, ‘thin crust’)
console.log(getSubTotal(orderCount))

<do not remove the three backticks above>

#2

orderCount= orderCount + 1 should be part of part of the takeOrder function content, not the parameter

the exercise approves because earlier written code isn’t re-evaluated


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.