Basic JavaScript - Multiple Identical Options in Switch Statements

what a do wrong on this code , in freecodecamp test it says it’s wrong, but in my vscode it’s coming out in the right order

//Codigo
function sequentialSizes(val){
    var answer = '';
    switch(val) {
        case 1:    
        case 2:    
        case 3:
            answer = 'low';
            break;
        case 4:
        case 5:    
        case 6:
            answer = 'mid';    
            break;
        case 7:
        case 8:    
        case 9:
            answer = 'high';    
            break;
    }
    return answer;
}
console.log(sequentialSizes(1));
console.log(sequentialSizes(2));
console.log(sequentialSizes(3));
console.log(sequentialSizes(4));
console.log(sequentialSizes(5));
console.log(sequentialSizes(6));
console.log(sequentialSizes(7));
console.log(sequentialSizes(8));
console.log(sequentialSizes(9));

// running tests

sequentialSizes(1)

should return the string

Low
sequentialSizes(2)

should return the string

Low
sequentialSizes(3)

should return the string

Low
sequentialSizes(4)

should return the string

Mid
sequentialSizes(5)

should return the string

Mid
sequentialSizes(6)

should return the string

Mid
sequentialSizes(7)

should return the string

High
sequentialSizes(8)

should return the string

High
sequentialSizes(9)

should return the string

High

// tests completed
// console output
low low low
mid mid mid
high high high

Challenge: Basic JavaScript - Multiple Identical Options in Switch Statements

Link to the challenge:

You have typos on your return values. Remember, JavaScript is case-sensitive.

1 Like

Compare to

These are not quite perfectly identical.

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