Skip to content

Commit 00cdc56

Browse files
Translate the section ''Number.isNaN and Number.isFinite"
1 parent 164089d commit 00cdc56

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

1-js/05-data-types/02-number/article.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -335,33 +335,33 @@ alert( isFinite(num) );
335335
336336
Veuillez noter qu'une chaîne de caractères vide ou une chaîne de caractères contenant seulement un espace est traitée comme `0` dans toutes les fonctions numérique, y compris `isFinite`.
337337
338-
````smart header="`Number.isNaN` and `Number.isFinite`"
339-
[Number.isNaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) and [Number.isFinite](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite) methods are the more "strict" versions of `isNaN` and `isFinite` functions. They do not autoconvert their argument into a number, but check if it belongs to the `number` type instead.
338+
````smart header="`Number.isNaN` et `Number.isFinite`"
339+
Les méthodes [Number.isNaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) et [Number.isFinite](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite) sont des versions plus "strictes" des fonctions `isNaN` et `isFinite`. Elles ne convertissent pas automatiquement leur argument en nombre, mais vérifient s'il appartient au type `number`.
340340
341-
- `Number.isNaN(value)` returns `true` if the argument belongs to the `number` type and it is `NaN`. In any other case it returns `false`.
341+
- `Number.isNaN(value)` retourne `true` si l'argument appartient au type `number` et s'il vaut `NaN`. Dans tous les autres cas, elle retourne `false`.
342342
343343
```js run
344344
alert( Number.isNaN(NaN) ); // true
345345
alert( Number.isNaN("str" / 2) ); // true
346346

347-
// Note the difference:
348-
alert( Number.isNaN("str") ); // false, because "str" belongs to the string type, not the number type
349-
alert( isNaN("str") ); // true, because isNaN converts string "str" into a number and gets NaN as a result of this conversion
347+
// Notez la différence :
348+
alert( Number.isNaN("str") ); // false, car "str" est de type "string"
349+
alert( isNaN("str") ); // true, car isNaN convertit la string "str" en un nombre et obtient NaN comme résultatde la conversion
350350
```
351351
352-
- `Number.isFinite(value)` returns `true` if the argument belongs to the `number` type and it is not `NaN/Infinity/-Infinity`. In any other case it returns `false`.
352+
- `Number.isFinite(value)` retourne `true` si l'argument appartient au type `number` et s'il vaut ni `NaN`, ni `Infinity`, ni `-Infinity`. Dans tous les autres cas, elle retourne `false`.
353353
354354
```js run
355355
alert( Number.isFinite(123) ); // true
356356
alert( Number.isFinite(Infinity) ); // false
357357
alert( Number.isFinite(2 / 0) ); // false
358358

359-
// Note the difference:
360-
alert( Number.isFinite("123") ); // false, because "123" belongs to the string type, not the number type
361-
alert( isFinite("123") ); // true, because isFinite converts string "123" into a number 123
359+
// Notez la différence :
360+
alert( Number.isFinite("123") ); // false, car "123" est de type "string"
361+
alert( isFinite("123") ); // true, car isFinite convertit la string "123" en un nombre 123
362362
```
363363
364-
In a way, `Number.isNaN` and `Number.isFinite` are simpler and more straightforward than `isNaN` and `isFinite` functions. In practice though, `isNaN` and `isFinite` are mostly used, as they're shorter to write.
364+
En quelque sorte, les fonction `Number.isNaN` et `Number.isFinite` sont plus simples et plus directes que les fonctions `isNaN` et `isFinite`. Cependant, en pratique `isNaN` et `isFinite` sont plus souvent utilisées car elles sont plus courtes à écrire.
365365
````
366366
367367
```smart header="Comparer avec Object.is"

0 commit comments

Comments
 (0)