nas5w/typeofnan-javascript-quizzes

Reduce Object answer should be Order not guaranteed

Closed this issue · 1 comments

Describe the bug
The reduce object question:

https://github.com/nas5w/typeofnan-javascript-quizzes/blob/master/content/questions/reduce-object/index.md

Has the correct answer specified as "hello", but the correct correct answer is "Order is not guaranteed".

The code in question uses Object.values which does not use a guaranteed ordering for its result. It uses ordering provided by EnumerateObjectProperties which has a description in the spec stating:

The mechanics and order of enumerating the properties is not specified...

A little more detail about it (calls out Object.keys but they use the same ordering) here:
https://www.reddit.com/r/learnjavascript/comments/d94kuh/sorting_an_object_how_can_i_make_the_10_key/f1eo4ri/

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://quiz.typeofnan.dev/reduce-object/
  2. Click on "Order is not guaranteed"
  3. Click on Submit

Expected behavior
Answer is correct

Closing. for-in ordering (https://github.com/tc39/proposal-for-in-order) has been fast tracked and has been approved as a stage 4 proposal making it official for ES2020.