-1

Why javascript Boolean object with false value evaluates to true.

var bln = new Boolean(false);
if (bln) {
    alert('true');
} else {
    alert('false');

}
Tushar
  • 82,599
  • 19
  • 151
  • 169
Muhammad Nasir
  • 2,010
  • 3
  • 34
  • 62

1 Answers1

0

Because new Boolean(false)(typeof new Boolean() == 'object') returns an object, not a primitive value, objects are by default truthy in nature

Arun P Johny
  • 376,738
  • 64
  • 519
  • 520
  • can you please provide me alternate solution for the same here http://stackoverflow.com/questions/33013512/dropdown-selected-option-text-issue-css-not-working – user3637224 Oct 09 '15 at 06:11