Switch statement in Javascript

Member

lou_lindgren

by lou_lindgren , in category: JavaScript , 2 months ago

Switch statement in Javascript

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
const zoom = 4;
let images_in_row;
switch(zoom){
    case 1:
        images_in_row = 1;
        break;
    case 2:
        images_in_row = 2;
        break;
    case 3:
        images_in_row = 3;
        break;
    case 4:
        images_in_row = 4;
        break;
    case 5:
        images_in_row = 6;
        break;
    case 6:
        images_in_row = 12;
        break;
}
Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers