'How to get the value of the Promise after it is resolved in node REPL
I have some code like this which I am trying in Node REPL:
result = lib.utils.kv["@0.1.16"]
.get({ key: "t2" });
Now I want to access the value in the string after it is resolved. When I try to print result, I first get
Promise { <pending> }
Then after sometime, I get
Promise {
`'{"locations":{"CH":5000013960,"AE":5000013961,"AF":5000013961}}'`
}
I want to get the output without the Promise prefix, and also ideally without that backtick.
I have tried to use an alternative syntax, but not sure whether this is the only way and whether this is even the right way?
(async () => {
result = await lib.utils.kv["@0.1.16"]
.get({ key: "t2" });
console.log(result);
})();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
