提交 46f2246d 编写于 作者: B blue.xiaofeng 提交者: Gitee

update zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md.

Signed-off-by: Nblue.xiaofeng <blue.xiaofeng@huawei.com>
上级 bed5c8a5
......@@ -354,9 +354,8 @@ console.log(url); //url可以被访问到,输出内容:http://127.0.0.1:8080
**正例:**
```javascript
// ES5.1使用var声明变量
function open() {
var url = 'http://127.0.0.1:8080';
let url = 'http://127.0.0.1:8080';
// todo something
}
open();
......@@ -364,7 +363,6 @@ console.log(url); //报错:Uncaught ReferenceError: url is not defined
```
```javascript
// ES6中,优先推荐使用let和const关键字来声明变量
function open() {
const url = 'http://127.0.0.1:8080';
//todo something
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册