Skip to content

Instantly share code, notes, and snippets.

@s-melnikov
Created July 15, 2015 09:57
Show Gist options
  • Select an option

  • Save s-melnikov/ebf7e98d1f426450befe to your computer and use it in GitHub Desktop.

Select an option

Save s-melnikov/ebf7e98d1f426450befe to your computer and use it in GitHub Desktop.
function query(obj) {
var str = "";
for (var prop in obj) {
str && (str += "&") || (str = "?");
if (obj.hasOwnProperty(prop)) str += prop + "=" + obj[prop];
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment