Created
February 20, 2020 13:17
-
-
Save ufhy/52cfded48c289eb600b78b1cff31ddab to your computer and use it in GitHub Desktop.
How to Turn an Object into Query String Parameters in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 | |
var queryString = Object.keys(params).map(key => key + '=' + params[key]).join('&'); | |
const queryString = Object.keys(params).map(function(key) { | |
return key + '=' + params[key] | |
}).join('&'); | |
// ES5 | |
var queryString = Object.keys(params).map(function(key) { | |
return key + '=' + params[key] | |
}).join('&'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment