Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>JS Eval ReplaceNew to Visual Studio Code? Get it now.
JS Eval Replace

JS Eval Replace

hanneshdc

|
1,478 installs
| (0) | Free
Replaces selected text with it's JavaScript evaluation
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

js-eval-replace README

Replaces selected text with it's JavaScript evaluation

Usage

Highlight any JavaScript expression or script, and evaluate it by pressing Ctrl+Alt+J on windows or linux, or Cmd+Alt+J on mac. The selected text is replaced. Alternatively, use the "Eval-Replace" option from the command list.

Examples

Copy the following pieces of text into an editor pane, highlight, and use eval-replace on them:

123 * 456
"This is some ugly\n\"unescaped\" text!"
"UPPERCASE TEXT".toLowerCase()
decodeURIComponent("q=%7B%22foo%22%3A%22Hello%20World%22%7D")

Also evaluates whole scripts! Use return for the result:

function factorial(n) {
    return n > 1 ? n * factorial(n - 1) : 1;
}
return factorial(4);
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft