I don't understand why an empty array, or an array with only 1 "numerical" value can be used in certain calculations.

```
[] * [] === 0 //true

[2] * [2] === 4 //true

["2"] * ["2"] === 4 //true

```

However, it does not seem that is always the case with every operator.

```
[2] + [1] === 3 // false, actual result is "21"

[2] - [1] === 1 // true

```

I also checked these, and saw expected results:

```
[4] === "4" // false
[4] === 4 // false

```

In most cases, I would expect `NaN` in any of these mathematical operations. What is it about JavaScript arrays that allows this? Is it because the array `toString` method is being used somehow internally?
['https://Stackoverflow.com/questions/36656845', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2056157/']
The arrays are coerced into strings, such that `[] == ""`, `[1] == "1"`, and `[1, 2] == "1,2"`.

When you do certain mathematical operations on strings, they are coerced into `Number` types.

For example, when you do `[2] * [2]` it becomes `"2" * "2"` which becomes `2 * 2`. You can even mix types and do `[2] * 2` or `"2" * [2]`.

When you try to use `+`, it attempts to concatenate the strings instead of coercing the strings to numbers. That's why `"2" + "2"`, `"2" + [2]`, and `[2] + [2]` each give you `"22"`.
When you do mathematical operations on the arrays JavaScript converts them to the **strings**. But **string** doesn't have multiply operator and then JavaScript converts them to the **numbers** because you try to multiply them:

```
[] * [] === 0 //  [] -> '' -> 0, result is 0 * 0 

[2] * [2] === 4 // [2] -> '2' -> 2, result is 4 * 4

["2"] * ["2"] === 4 // ["2"] -> '2' -> 2, result is 4 * 4

```

**String** has a `+` operator:

```
[2] + [1] === 3 // '2' + '1', result is "21"

```

but doesn't have a `-` operator, therefore JavaScript converts them to the **numbers** too:

```
[2] - [1] === 1 // true, because they are numbers

```

`===` it's *strict equality*, means that the objects being compared must have the same type.

```
[4] === "4" // false, you are comparing array with a string
[4] === 4 // false, you are comparing array with a number

```