Free tools Windows power users keep installed
One-click scans. No signup required.
console.log(getValue()) shows a Promise because getValue() returns an object for a result that will be available later—not the result itself. To log the actual value, handle the Promise with await or .then(). The exact display, such as Promise {}, varies by JavaScript runtime and console.
What Promise {} means
A Promise represents the eventual success or failure of an asynchronous operation. When you call a function that returns a Promise, JavaScript gives you that Promise object immediately; the operation’s fulfillment value may not be ready yet. That is why console.log(getValue()) logs the Promise rather than its eventual value. MDN’s Promise reference describes the object, and its debugging guide illustrates the same distinction with fetch().
The braces in a console’s rendering are not the operation’s eventual result. A Promise can be pending, fulfilled, or rejected. A pending Promise has no fulfillment value to log yet; a rejected Promise has an error reason rather than a successful value. Handle either outcome instead of relying on how the console displays the object.
How to log the fulfilled value
Use await with an async function
Use await when you want to work with the result in sequential statements. It pauses the surrounding async function until the Promise settles. If the Promise fulfills, the expression evaluates to its value; if it rejects, await throws the rejection reason, which you can catch.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errors#1 Best Overall
async function showValue() {
try {
const value = await getValue();
console.log(value);
} catch (error) {
console.error(error);
}
}
showValue();
await is allowed inside an async function and at the top level of a JavaScript module. In a regular script, put it inside an async function as above. It does not block the entire main thread. See MDN’s await reference.
Use .then() and .catch()
A Promise handler is an alternative when you want to attach callbacks directly:
Rank #2
getValue()
.then((value) => {
console.log(value);
})
.catch((error) => {
console.error(error);
});
The fulfillment callback receives the value; the rejection callback in .catch() handles failure. A Promise chain carries a handler’s returned value to the next fulfillment handler. If a later step depends on asynchronous work started in a handler, return that Promise so the chain can wait for it; otherwise, the work is not tracked by the chain. MDN explains this in its guide to using promises.
Which style should you choose?
| Approach | Typical context | Readability and error handling |
|---|---|---|
await |
Inside an async function or at module top level | Reads like sequential code; handle rejection with try/catch. |
.then() |
Any Promise chain | Composes callbacks; handle rejection with .catch() or a rejection handler. |
Both approaches wait for the asynchronous result and expose its fulfillment value. Neither makes the operation synchronous.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallWhy an async function still logs a Promise
Calling an async function always returns a Promise, even when its body returns an ordinary value. An await inside that function affects what the function does next; it does not make the caller receive a synchronous value.
async function getValue() {
return 42;
}
console.log(getValue()); // Promise object
The caller must handle the returned Promise too:
getValue().then((value) => console.log(value));
Or, from another async function, use const value = await getValue();. See MDN’s async function reference and its Promises tutorial.
Rank #4
Logging data from fetch()
fetch(url) returns a Promise for a Response, not the response body. Calling response.json() also returns a Promise. Await both operations to log the parsed data. If HTTP status errors should be treated as failures, check response.ok: a fulfilled fetch Promise does not by itself mean the server returned a successful status.
async function showData(url) {
try {
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP error: ${response.status}`);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
}
This pattern waits for the response, checks its HTTP status, then waits for body parsing before logging. The MDN Promises tutorial covers this sequence and error handling.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →

