Pass multiple variables in url javascript

I am trying to have 2 variable values passed in a url, which url will be redirected after. How can I insert them in a JavaScript string?

I have:

var a = document.getElementById["username_a"].value;
var b = document.getElementById["username_b"].value;

and want something like: var string_url = "//www.example.com/?{a}blabla={b}" and then redirect somehow.

In PHP I would go with that code for example:

Chủ Đề