在交换机外的javascript(标签:东西)中使用标签有什么意义? [英] What is the point of using labels in javascript (label: stuff here) outside switches?

查看:58
本文介绍了在交换机外的javascript(标签:东西)中使用标签有什么意义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开关外面使用javascript(标签:东西)中的标签有什么意义?

What is the point of using labels in javascript (label: stuff here) outside switches?

推荐答案

你可以使用它们作为goto语句中断继续,尽管你很少在实践中看到这一点。 您可以在此处找到一些示例

You can use them as goto statements on break and continue, though admittedly you rarely see this in practice. You can find a few examples here.

这是一个快速的:

myLabel:
for(var i=0; i<10; i++) {
  if(i==0) continue myLabel; //start over for some reason
}    

这篇关于在交换机外的javascript(标签:东西)中使用标签有什么意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆