Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created July 28, 2012 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/3194476 to your computer and use it in GitHub Desktop.
Save isaacs/3194476 to your computer and use it in GitHub Desktop.
$ ./node -pe 'with(this){__filename}'
eval
$ ./node --use_strict -pe 'with(this){__filename}'
eval:1
with(this){__filename}
^^^^
SyntaxError: Strict mode code may not include a with statement
at Object.<anonymous> (eval-wrapper:5:22)
at Module._compile (module.js:450:26)
at evalScript (node.js:282:25)
at startup (node.js:76:7)
at node.js:623:3
$ ./node -pe 'with(this){__filename{}'
eval:1
with(this){__filename{}
^
SyntaxError: Unexpected token {
at Object.<anonymous> (eval-wrapper:5:22)
at Module._compile (module.js:450:26)
at evalScript (node.js:282:25)
at startup (node.js:76:7)
at node.js:623:3
$ ./node -pe 'asdf = 1900'
1900
$ ./node --use_strict -pe 'asdf = 1900'
eval:1
asdf = 1900
^
ReferenceError: asdf is not defined
at eval:1:6
at Object.<anonymous> (eval-wrapper:5:22)
at Module._compile (module.js:450:26)
at evalScript (node.js:282:25)
at startup (node.js:76:7)
at node.js:623:3
$ ./node --use_strict -pe 'asdf += 1000'
eval:1
asdf += 1000
^
ReferenceError: asdf is not defined
at eval:1:1
at Object.<anonymous> (eval-wrapper:5:22)
at Module._compile (module.js:450:26)
at evalScript (node.js:282:25)
at startup (node.js:76:7)
at node.js:623:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment