Unknown JavaScript syntax before for…in

前端 未结 3 1349
慢半拍i
慢半拍i 2020-12-12 00:32

I am reading a book about single-page applications and at some point there is this for...in loop:

KEYVAL:
for(key_name in arg_map){
    if(arg_map.hasOwnProp         


        
3条回答
  •  旧巷少年郎
    2020-12-12 01:12

    It is a label, sort of a line-number but not locked to a line position.

    Continue jumps to this label like a GOTO.

    When this criteria is furfilled:

    if(key_name.indexOf('_') === 0) continue KEYVAL;
    

    JavaScript continues from that label above.

提交回复
热议问题