javascript beginner ينتهي في 2026-11-17

Parse a query string

Write parseQuery(qs) that turns a URL query string into an object, without URLSearchParams.

  • A leading ? is optional: "?page=2&q=flask" gives { page: "2", q: "flask" }.
  • Values are URL-decoded, and + means a space.
  • A key that appears more than once gives an array of values, in order.
  • A key without = gets an empty string.

Acceptance criteria

  • An empty string gives {}.
  • The tests at the bottom print All tests passed.

حلّه 0 شخصًا حتى الآن.

javascript
المحررCtrl + Enter

            
        

عندما تطبع الاختبارات "All tests passed" يُعلَّم التحدي كمحلول في هذا المتصفح.

إرسال حلك للمراجعة