Switch case operator. Javascript example open

Switch case operator. Javascript example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
        switch (Color) {
            case 'green':
                console.log('Color Green')
                break//if the condition is met, we stop the operator
            case 'yellow':
                console.log('Color yellow')
                break
            case 'red':
                console.log('Color red')
                break
            default://Default value
                console.log('undefined color')
        }

If necessary, you can process several conditions at once:

        switch (Color) {
            case 'green':
            case 'yellow':
                console.log('Color green and yellow')
                break
            case 'red':
                console.log('Color red')
                break
            default://Default value
                console.log('undefined coloe')
        }
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation