JStestDriver assertEquals ("000011",11) shouldn't be false?

294 Views Asked by At

I expected that JSTD treated "000011" (string) as not equal to 11 (number).

But, taking a look at he actual JSTD code, assertEquals returns

(a === e) 

only if one of the elements are Objects, otherwise returns

(a == e)

isn't this wrong?

1

There are 1 best solutions below

1
On

I can't really answer your main question (whether the assertion implementation is "wrong"), but to get at what you are trying to do, you can always write an assertion as such:

var str = '000011';
var num = 11;

assertTrue(str !== num);

Or if you want to ensure that the two variables have the same value and type:

assertTrue(str === num);