General area when it fits no where else

Moderator: Mmiscool

User avatar
By loyalwar
#93005 hi, Recently I read a post have some ways to fix error like you, I think it maybe good you can try:
- Destructuring assignment (a feature of ES2015) lets you extract items of an array into variables. For example, the following code destructures an array:
let a;
let b;
[a, b] = [1, 2, 3];
a; // => 1
b; // => 2
- Or Temporary variable: Swapping variables using a temporary variable is classic. As the name suggests, this approach requires an additional temporary variable.Let's swap the values of variables a and b using a temporary variable temp:
let a = 1;
let b = 2;
let temp;
temp = a;
a = b;
b = temp;
a; // => 2
b; // => 1