I am a total beginner I need help with switch

switch(dieRoll) {
    case(dieRoll === 1):
        console.log('You roll a 1.');
 case(dieRoll === 2):
    console.log('You roll a 2.');
 case (dieRoll === 3):
    console.log('You roll a 3.');
    case (dieRoll === 4) :
    console.log('You roll a 4.');
    case (dieRoll === 5) :
    console.log('You roll a 5.');
    case (dieRoll === 6):
    console.log('You roll a 6.');
    console.log('This die only has 6 sides man...');

// Output:

>>>>Code is incorrect
You should consider the 1 value in your switch ( I think I did :frowning:)


1 Like

OMG I think I like to complicate…
thank you sooo much!

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.


It was not clear that it was a challenge. Some parts was not visible.

The general policy on the forum is to help people write their own code instead of just giving them code that does what they ask. The forum is not intended to be a candy machine of code because we want to help people learn how to write code.