From dd9c96bbb5188b48d39e9e4b951bd7244fc1e0fd Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Fri, 6 Mar 2020 09:58:07 +0200 Subject: [PATCH] Update descriptions for pad and toDecimalMark Missing prototypes in the code explanations. --- snippets/pad.md | 4 ++-- snippets/toDecimalMark.md | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/snippets/pad.md b/snippets/pad.md index 9a750ccde..60c59f565 100644 --- a/snippets/pad.md +++ b/snippets/pad.md @@ -5,7 +5,7 @@ tags: string,beginner Pads a string on both sides with the specified character, if it's shorter than the specified length. -Use `String.padStart()` and `String.padEnd()` to pad both sides of the given string. +Use `String.prototype.padStart()` and `String.prototype.padEnd()` to pad both sides of the given string. Omit the third argument, `char`, to use the whitespace character as the default padding character. ```js @@ -17,4 +17,4 @@ const pad = (str, length, char = ' ') => pad('cat', 8); // ' cat ' pad(String(42), 6, '0'); // '004200' pad('foobar', 3); // 'foobar' -``` \ No newline at end of file +``` diff --git a/snippets/toDecimalMark.md b/snippets/toDecimalMark.md index 861875435..b2ab2210b 100644 --- a/snippets/toDecimalMark.md +++ b/snippets/toDecimalMark.md @@ -3,7 +3,9 @@ title: toDecimalMark tags: utility,math,beginner --- -Use `toLocaleString()` to convert a float-point arithmetic to the [Decimal mark](https://en.wikipedia.org/wiki/Decimal_mark) form. It makes a comma separated string from a number. +Converts a number to a decimal mark formatted string. + +Use `Number.prototype.toLocaleString()` to convert the numbre to decimal mark format. ```js const toDecimalMark = num => num.toLocaleString('en-US'); @@ -11,4 +13,4 @@ const toDecimalMark = num => num.toLocaleString('en-US'); ```js toDecimalMark(12305030388.9087); // "12,305,030,388.909" -``` \ No newline at end of file +```