I've got an array that needs to become a string separated by ampersands.
Input:
arr = ['incomplete', 'complete', 'processing']
Desired Output:
"query[]=incomplete&query[]=complete&query[]=processing"
My attempt:
"query[]="+arr.join("&query[]=")
Result:
"query[]=incomplete&query[]=complete&query[]=processing"
I've also tried different ways of trying to escape the ampersand, but I always end up with "& amp;" in my output. For this string to work on the backend, I need a simple ampersand alone.
I have achieved my intended goal with an iterator, but I'll bet that javascript offers a more elegant way to accomplish this. So I'm asking this as a learning exercise.