minor fixes
This commit is contained in:
parent
cbd7d7831c
commit
72aa4f0b97
2 changed files with 3 additions and 1 deletions
|
@ -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 |
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue