['', ''] == ['', '']
yields false
because arrays in JavaScript are treated as objects with reference semantics. When comparing two arrays, the comparison is actually between their unique reference IDs, which will be distinct for each array. Therefore, even if the arrays appear identical, they are different references.
To verify that an array only contains empty strings, you can utilize Array.prototype.every
like this:
myArray = ['']
console.log(myArray.every(el => el === '')) // true
myArray = []
console.log(myArray.every(el => el === '')) // true
myArray = ['test']
console.log(myArray.every(el => el === '')) // false
If you are working in an environment without ES6 support, you can replace el => el === ''
with
function(el) { return el === '' }
.