-1

Why javascript Boolean object with false value evaluates to true.

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

}
Tushar
  • 85,780
  • 21
  • 159
  • 179
Muhammad Nasir
  • 2,126
  • 4
  • 35
  • 63

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
  • 384,651
  • 66
  • 527
  • 531
  • 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