Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Log and returnNew to Visual Studio Code? Get it now.
Log and return

Log and return

darkmattr

|
419 installs
| (2) | Free
Log the return value of a function to the console
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

log-and-return README

Converts your javascript function return statements into a statement that will first log, then return the value. Useful for debugging!

Features

Turns

function myFunc() {
  let x = 2 + 2;
  return x;
}

into

function myFunc() {
  let x = 2 + 2;
  return (a => console.log(a) || a)(x);
}

You can make this happen by simply running the command with your cursor anywhere on the return statement line, or by selecting the return statement. In order to work with multi-line return statements, you must select the whole statement.

1.0.0

Initial release of log-and-return.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft