mirror of
https://github.com/labs42io/clean-code-typescript.git
synced 2025-04-18 15:13:34 +00:00
Make paragraph about ReadonlyArray<T>
read more fluently
This commit is contained in:
parent
c4c6c52c99
commit
40ba290cc7
1 changed files with 3 additions and 3 deletions
|
@ -1293,15 +1293,15 @@ interface Config {
|
|||
}
|
||||
```
|
||||
|
||||
Case of Array, you can create a read-only array by using `ReadonlyArray<T>`.
|
||||
do not allow changes such as `push()` and `fill()`, but can use features such as `concat()` and `slice()` that do not change the value.
|
||||
For arrays, you can create a read-only array by using `ReadonlyArray<T>`.
|
||||
It doesn't allow changes such as `push()` and `fill()`, but can use features such as `concat()` and `slice()` that do not change the array's value.
|
||||
|
||||
**Bad:**
|
||||
|
||||
```ts
|
||||
const array: number[] = [ 1, 3, 5 ];
|
||||
array = []; // error
|
||||
array.push(100); // array will updated
|
||||
array.push(100); // array will be updated
|
||||
```
|
||||
|
||||
**Good:**
|
||||
|
|
Loading…
Add table
Reference in a new issue