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"`.
In regards to `+`, [`+` is a coercive operator on `Strings`](http://www.ecma-international.org/ecma-262/5.1/#sec-11.6.1), irrespective of it being the `lvalue` and `rvalue`, I'll quote the specification here:

> 
> If `Type(lprim`) is String or `Type(rprim`) is `String`, then Return the
>  `String` that is the result of concatenating `ToString(lprim`) followed by
>  `ToString(rprim`)
> 
> 
> 

[Multiplication however doesn't follow the same rules](http://www.ecma-international.org/ecma-262/5.1/#sec-11.5), it does however apply [`ToNumber`](http://www.ecma-international.org/ecma-262/5.1/#sec-9.3), which as you've noticed, casts a `[Number]` to -> `Number` (`+` does this as well, but it is a later step in the operator's definition)

Your last statement is answered by two rules of the `SameValue` algorithm defined in the spec, namely, if two values are of a different type, return `false`, alternatively, if two objects refer to the ptr, return true. Thus

```
a = [1];
b = [1];
a === b; // false

```