QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 21

Which ordinary objects are truthy in a boolean context? Select all that apply.

  1. An empty arrayՃիշտ պատասխան
  2. The empty string
  3. An empty ordinary objectՃիշտ պատասխան
  4. The value null

Բացատրություն

Both an empty array and a separately created empty ordinary object are truthy because ordinary objects do not become falsy when they contain no elements or properties. Treating an empty container like an empty string incorrectly transfers a primitive-string rule to objects.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 21: Which ordinary objects are truthy in a boolean context?… · JavaScript Fundamentals · Questena