doc: update docs/javascript.md

This commit is contained in:
小弟调调
2025-09-28 00:46:26 +08:00
parent 4f132524a0
commit b4db543088

View File

@@ -886,7 +886,6 @@ for (let index in fruits) {
``` ```
### label 语句 ### label 语句
<!--rehype:wrap-class= row-span-2-->
```js ```js
var num = 0; var num = 0;
@@ -916,10 +915,16 @@ for (let fruit of fruits) {
// => apple // => apple
// => orange // => orange
// => banana // => banana
for (let [index, value] of fruits.entries()) {
console.log(index, value);
}
// => 0 apple
// => 1 orange
// => 2 banana
``` ```
### for await...of ### for await...of
<!--rehype:wrap-class= row-span-2-->
```javascript ```javascript
async function* asyncGenerator() { async function* asyncGenerator() {