gpt4 book ai didi

javascript - javascript 语句中是否必须使用分号?

转载 作者:可可西里 更新时间:2023-11-01 02:56:50 25 4
gpt4 key购买 nike

<分区>

我想知道,这合法吗?

function test()
{
alert ("hello")
$("#loading").show();
}

或者我应该这样写:

function test()
{
alert ("hello");
$("#loading").show();
}

分号在 JavaScript 中是可选的吗?因为我在论坛上看到了这个:

No, semicolons are usually optional in JavaScript (Google for ASI / automatic semicolon insertion). Using them makes the code look much cleaner though and ASI is a horrible mis-feature (at least in my opinion).

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com