• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ArkTS Changelog
2
3## cl.arkts.1 Fix for Array Content Exceptions When Redefining Arrays with Literals After Element Deletion
4
5**Access Level**
6
7Public API
8
9**Reason for Change**
10
11After an element is deleted from an array defined by a literal, the array content is abnormal when the literal is used to define the array again.
12
13**Impact of the Change**
14
15This change requires application adaptation.
16
17Before the change, when an array defined by a literal has elements deleted and is redefined with the same literal, the new array contains the elements that remained after deletion.
18
19After the change, when an array defined by a literal has elements deleted and is redefined with the same literal, the new array contains the elements as originally defined by the literal.
20
21**Start API Level**
22
236
24
25**Change Since**
26
27OpenHarmony SDK 6.0.0.32
28
29**Key API/Component Changes**
30
31N/A
32
33**Adaptation Guide**
34
35Check for instances where arrays are defined using literals and elements are deleted without other modifications.
36
37For example:
38
39```typescript
40for (let i = 0; i < 2; i++) {
41    let arr = [0, 0]
42    console.log(JSON.stringify(arr));
43    delete arr[0];
44}
45```
46
47Before the change, the output of this example is:
48
49```
50[0,0]
51[null,0]
52```
53
54After the change, the output of this example is:
55
56```
57[0,0]
58[0,0]
59```
60
61This change fixes the issue, ensuring that when an array defined by a literal has elements deleted and is redefined with the same literal, the new array contains the elements as originally defined by the literal.
62