Well in case of "==", array is converted to toString and then compared due to loose comparison, so it equates to true. So what happens is this:
var a = [1,2,3];
var b = '1,2,3';
a == b //is same as
a.toString() === b //true
If you want to evaluate to true in a strict mode, you may also do something like this:
var a = [1,2,3];
var b = '1,2,3';
a = a.join(',')
console.log(b === a);
Whenever you're loose comparing (with '=='), javascript interpreter tries it best to to convert both values to a common type and match them. To quote MDN
Loose equality compares two values for equality, after converting both
values to a common type. After conversions (one or both sides may
undergo conversions), the final equality comparison is performed
exactly as === performs it.
Now your confusion is,
what variable a stores inside it , is just memory address of the array . So in first code snippet you say that a==b is same as a.toString==b but whats inside a is a memory address ,so when a memory address is converted to a string how is it equal to corresponding strings of an array.
Well, note here when you comparing two variables, you're not comparing the memory address of them but the values stored at them :) So it's not the memory address that is getting converted to toString but the value stored at it.
Also, there's one more flaw in this thinking.
consider,
var a = 4, // a holds address of variable a
b =4; //b holds the address of variable b
Now, these two variables are definitely holding different memory addresses so they wouldn't have been equated to true which is not true. I hope you got the point.