[JavaScript-04]Switch

1. Switch

// Switch 语句
const color = 'green';

switch (color)
{
    case 'red':
        console.log('color is red');
        break;
    case 'blue':
        console.log('color is blue');
        break;
    default:
        console.log('color is NOT red or blue');
        break;
}

END

posted @ 2022-11-09 23:24  LeoShi2020  阅读(20)  评论(0)    收藏  举报