From 72aa4f0b9783a38155dd766ef50f025e672cfcee Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Sun, 14 Aug 2022 15:26:02 +0300 Subject: [PATCH] minor fixes --- 1-js/05-data-types/03-string/article.md | 2 ++ 7-animation/3-js-animation/text.view/index.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/1-js/05-data-types/03-string/article.md b/1-js/05-data-types/03-string/article.md index b3535866..255eb29a 100644 --- a/1-js/05-data-types/03-string/article.md +++ b/1-js/05-data-types/03-string/article.md @@ -445,6 +445,8 @@ There are 3 methods in JavaScript to get a substring: `substring`, `substr` and alert( str.substr(-4, 2) ); // 'gi', from the 4th position get 2 characters ``` + This method resides in the [Annex B](https://tc39.es/ecma262/#sec-string.prototype.substr) of the language specification. It means that only browser-hosted Javascript engines should support it, and it's not recommended to use it. In practice, it's supported everywhere. + Let's recap these methods to avoid any confusion: | method | selects... | negatives | diff --git a/7-animation/3-js-animation/text.view/index.html b/7-animation/3-js-animation/text.view/index.html index 001b0ae9..4947e4cd 100644 --- a/7-animation/3-js-animation/text.view/index.html +++ b/7-animation/3-js-animation/text.view/index.html @@ -29,7 +29,7 @@ And stood awhile in thought. timing: bounce, draw: function(progress) { let result = (to - from) * progress + from; - textArea.value = text.substr(0, Math.ceil(result)) + textArea.value = text.slice(0, Math.ceil(result)) } }); }