I am a total beginner I need help with switch


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


// Output:

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

https://jsfiddle.net/octrh845/

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.

2 Likes

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.