[javascript] Return from a promise then()