How do I get the string representation of a variable as shown when it's output by console.log()?
e.g.,
const myFunc = async () => 'my string';
ret = myFunc();
console.log(ret); // Promise { 'my string' }
stringRepresentation = ret.someMethod(); // is there a method or some other way?
console.assert(stringRepresentation === "Promise { 'my string' }");
I'm primarily interested running this in Node.js (but also curious if it's possible when running in a browser).