diff --git a/README.md b/README.md index c5f79a6f48..dd9e33241d 100644 --- a/README.md +++ b/README.md @@ -2796,11 +2796,14 @@ Other Style Guides - [22.1](#coercion--explicit) Perform type coercion at the beginning of the statement. - - [22.2](#coercion--strings) Strings: + - [22.2](#coercion--strings) Strings: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers) ```javascript // => this.reviewScore = 9; + // bad + const totalScore = new String(this.reviewScore); // typeof totalScore is "object" not "string" + // bad const totalScore = this.reviewScore + ''; // invokes this.reviewScore.valueOf() @@ -2812,7 +2815,7 @@ Other Style Guides ``` - - [22.3](#coercion--numbers) Numbers: Use `Number` for type casting and `parseInt` always with a radix for parsing strings. eslint: [`radix`](http://eslint.org/docs/rules/radix) + - [22.3](#coercion--numbers) Numbers: Use `Number` for type casting and `parseInt` always with a radix for parsing strings. eslint: [`radix`](http://eslint.org/docs/rules/radix) [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers) ```javascript const inputValue = '4'; @@ -2859,7 +2862,7 @@ Other Style Guides ``` - - [22.6](#coercion--booleans) Booleans: + - [22.6](#coercion--booleans) Booleans: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers) ```javascript const age = 0;