gpt4 book ai didi

javascript - 何时使用分号

转载 作者:行者123 更新时间:2023-12-03 12:33:48 25 4
gpt4 key购买 nike

<分区>

特别是在 JavaScript 中,什么时候使用分号,什么时候不用。

这是一个示例代码片段;

function Drawable() {
this.init = function(x, y) {
this.x = x;
this.y = y;
}

this.speed = 0;
this.canvasWidth = 0;
this.canvasHeight = 0;

this.draw = function() {
};
}

谁能告诉我为什么

this.init = function(x,y) {}

不以分号结尾,但是

this.draw = function(){};

在上面的代码片段中是否以分号结尾?

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