Ask coding questions

← Back to all posts
I can't seem to figure out where I'm going wrong here. Please help.
gage3121 (1)

I have the majority of the code correct but it keeps telling me that for the "bakeCandy" portion of the code that "Expected mixed: false, baked: true to equal baked: false" and I have no idea where any part of my code is coming out to "mixed: false" to begin with. Please help me figure out what I'm missing.

Answered by malvoliothegood (770) [earned 5 cycles]
View Answer
Commentshotnewtop
malvoliothegood (770)

It would be good to see the full instruction you were given. Otherwise helpers are in the dark. From looking at your code I would think the buyChocolate function should be something like this:

const buyChocolate = () => {
  const chocolate = {
    type: "Milk chocolate",
    /* Default values */
    flavor: '',
    mixed: false,
    baked: false
  }
  return chocolate
}

Also, you have errors in three of your functions. For example if (flavor = "Mint") should be something like if (chocolate.flavor === "Mint") Note the triple equals (testing for strict equality) rather than the single equals (the assignment operator).

gage3121 (1)

@malvoliothegood Thank you so much! Also definitely noted about the instructions, sorry about that I'm still fairly new to this whole thing.

Coder100 (12439)

Hello, line 30-31 you forgot a closing brace.
Also, to compare equality, use == or === not =

Here's the fixed code

Mark as correct answer if it has helped you!