Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 committed Jul 17, 2024
1 parent a4ac061 commit d92346a
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ L'en-tête d'une boucle [`for...in`](/fr/docs/Web/JavaScript/Reference/Instructi

Cet exemple déclenchera une exception `SyntaxError` :

```js example-bad
"use strict";

var obj = {a: 1, b: 2, c: 3 };
```js-nolint example-bad
const obj = { a: 1, b: 2, c: 3 };
for (var i = 0 in obj) {
for (const i = 0 in obj) {
console.log(obj[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ SyntaxError: for-in loop variable declaration may not have an initializer. (Chro

この例では `SyntaxError` が発生します。

```js example-bad
"use strict";

var obj = {a: 1, b: 2, c: 3 };
```js-nolint example-bad
const obj = { a: 1, b: 2, c: 3 };
for (var i = 0 in obj) {
for (const i = 0 in obj) {
console.log(obj[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ slug: Web/JavaScript/Reference/Errors/Invalid_for-in_initializer

이 예제는 `SyntaxError`를 발생시킵니다.

```js example-bad
"use strict";

var obj = {a: 1, b: 2, c: 3 };
```js-nolint example-bad
const obj = { a: 1, b: 2, c: 3 };
for (var i = 0 in obj) {
for (const i = 0 in obj) {
console.log(obj[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function format(template, ...args) {
...args.map((num) =>
(Object.is(num, -0)
? "-0"
: formattedNumbers.get(num) ?? String(num)
: (formattedNumbers.get(num) ?? String(num))
).padEnd(5),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ alert(show_own_props(o, "o")); /* alerts: o.color = red */
Prior to Firefox 40, it was possible to use an initializer expression
(`i=0`) in a `for...in` loop:

```js example-bad
```js-nolint example-bad
const obj = { a: 1, b: 2, c: 3 };
for (var i = 0 in obj) {
console.log(obj[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ No [modo estrito](/pt-BR/docs/Web/JavaScript/Reference/Strict_mode), contudo, é

Esse exemplo lança um `SyntaxError`:

```js example-bad
```js-nolint example-bad
const obj = { a: 1, b: 2, c: 3 };
for (const i = 0 in obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ for (var prop in obj) {

Anterior ao SpiderMonkey 40, era possível usar uma expressão inicial com o laço for...in, conforme exemplo que se segue:

```js example-bad
var obj = {a:1, b:2, c:3};
for(var i=0 in obj) {
```js-nolint example-bad
var obj = { a: 1, b: 2, c: 3 };
for (var i = 0 in obj) {
console.log(obj[i]);
}
// 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ for (var prop in obj) {

## Поддержка: инициализатор переменных

До SpiderMonkey 40, можно было инициализировать переменные (`i=0`) в цикле `for...in`:
До SpiderMonkey 40, можно было инициализировать переменные (`i = 0`) в цикле `for...in`:

```js example-bad
var obj = {a:1, b:2, c:3};
for(var i=0 in obj) {
```js-nolint example-bad
var obj = { a: 1, b: 2, c: 3 };
for (var i = 0 in obj) {
console.log(obj[i]);
}
// 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ SyntaxError: for-in loop variable declaration may not have an initializer. (Chro

下面这个示例会报语法错误(`SyntaxError`):

```js example-bad
"use strict";

var obj = {a: 1, b: 2, c: 3 };
```js-nolint example-bad
const obj = { a: 1, b: 2, c: 3 };
for (var i = 0 in obj) {
for (const i = 0 in obj) {
console.log(obj[i]);
}
Expand Down

0 comments on commit d92346a

Please sign in to comment.