I added the following code from the login() method found in the wix-users-backend
API. I am not new to OOP, but I’m still learning Java. I can’t seem to find an explanation to the syntax of the return statements (and therefore what to do with the returned results). They appear to be objects, but the first return with sessionToken doesn’t seem to be a key:value pair and “approved” and “reason” are in double-quotes, which I thought was incorrect. Thanks in advanced.
Line 6 is wrong.
You’re returning an object. Object should only contain couples of keys and values.
like {key1: value1, key2: value2}
But you put there: sessionToken which is value only.
In JavaScript, we have a few syntaxes for declaration of an object properties
const value = "Property value";
// in ES5
const a = { value: value }; // ES5
const b1 = { "value": value }; // key as a string
const b2 = { 'value': value }; // the same
// in ES6
const c = { value }; //the same as { value: value };
// and Dynamic Property Keys
const key = 'value';
const d = { [key]: value };
all examples are valid and supported in JavaScript