0

The parse module in querystring lib lists the following.

querystring.parse(str[, sep[, eq[, options]]])

I've also seen the following code

const { parse } = require('querystring')

...

let actual = parse(queryString)[queryStringPropName]

Why is the array appended after parse(queryString) and more importantly, why does it work?

The array-appending was not seen in querystring's API page in NodeJS.

Can anyone explain?

1 Answer 1

1

That's because parse(queryString) is an object and in this case, [queryStringPropName] is not an array, it is to access a prop of the object parse(queryString)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.