typeof.currentElement.innerText not working in Firefox?

V

VK

RobG said:
If the LHS is a variable, e.g.

var y = 'string'; // or the result of some function

then:

if ( y = typeof x )

will always be true. So maybe for typeof tests it is always better to
put typeof on the left because:

if (typeof x = ... )

will always give a syntax error regardless of what is on the other side
of the assignment operator, but the reverse is not the case.

That's really a game theory puzzle (~= artillerist vs. infantery man in
the most simplified form). By my observations it will "explode" with
higher probability on undefined values: so I prefer solutions A, C. But
as any game theory it's totally dependant on the "coin rules", then in
another situations solution B can be the best.
That's why I'd like to insistently repeat that ('undefined' == typeof
x) is NOT a sign of a "real programming experience", NOT proper vs.
wrong, NOT anything of this kind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,433
Messages
2,571,683
Members
48,796
Latest member
Greg L.

Latest Threads

Top