We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af31865 commit 7a17d26Copy full SHA for 7a17d26
Sprint-2/implement/querystring.js
@@ -10,17 +10,17 @@ function parseQueryString(queryString) {
10
if (!pair) {
11
continue;
12
}
13
- const equalIndex = pair.indexOf("=");
14
- if (equalIndex === -1) {
+ const index = pair.indexOf("=");
+ if (index === -1) {
15
queryParams[pair] = "";
16
- continue;
+ } else {
17
+ const key = pair.slice(0, index);
18
+ const value = pair.slice(index + 1);
19
+ queryParams[key] = value;
20
- const key = pair.substring(0, equalIndex);
- const value = pair.substring(equalIndex + 1);
- queryParams[key] = value;
21
22
-
23
return queryParams;
24
+console.log(parseQueryString("equation=x=y+1&sound=none"));
25
26
module.exports = parseQueryString;
0 commit comments