0

When tax is called as false the function below is supposed to print the array food, the prices and the foods beside eachother each on a new line, this is just the start of the code. When true is the variable in tax then it will only print the name of the food and not the price. I need help with syntax and formatting

 function tax(fact) {
    if (fact == "false") {
        console.log(food[i] + food[i])
    }
    else if (fact == "true") {
        console.log(food[i])
    }
}
const food = ["Italian pasta" = "11.46", "Rice with veggies" = "10.38", "Chicken with 
potatoes" 
= "18.66", "Vegeterian pizza" = "7.74" ]
tax("false")
Mustafa I
  • 17
  • 2

0 Answers0