Is there any way to automatically number the cases of a switch() statement? I need each case to increment by 1's.
So something like this: http://jsfiddle.net/rWWhJ/
switch(x)
Say I want to add another day after Tuesday. I'd have to add one to every number next to it manually. Is there a way to do this automatically? I tried Notepad++'s collumn selection, but that messes up the other lines. All I need to be able to do is increment each case number by 1, starting from the first.
Try like this
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var day = days[x];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.