I would like to create an object from variables where the keys are the variable names, and the values are the variable values:
let username = "foo";
let password = "bar";
let request = {
username: username,
password: password
};
Resulting value of request:
{"username":"foo","password":"bar"}
Can this be done more simply, without writing username or password or any other variable name twice per object attribute?
let request = {username, password}not supported in old crappy browsers tho.