After reading Running V8 Javascript Engine Standalone decided to try installing V8
for the express purpose of running JavaScript at terminal
.
Following guidance at Install depot_tools
$ sudo apt-get git
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=`pwd`/depot_tools:"$PATH"
Though have not yet built [V8][2]
. Instead, first tried the suggestion at linked Question of using nodejs
. Note, have limited experience with nodejs
other than attempting to use nodejs
to resolve How to test if jQuery 3.0 beta is Promises/A+ compatible in browser?
$ sudo apt-get install nodejs
> x = 10*5
50
> x
50
> let {id} = {id:123}
...
... id
...
> id
ReferenceError: id is not defined
at repl:1:1
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
> {id} = {id:123}
ReferenceError: Invalid left-hand side in assignment
at Object.exports.createScript (vm.js:24:10)
at REPLServer.defaultEval (repl.js:225:25)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
> x
50
> var y = 456
undefined
> y
456
> var [a, b] = [1,2]
... a
...
> function test(a = 123) {return a}
... test(5)
...
...
Questions:
- What is
repl
? - Why is
nodejs
not recognizing destructuring assignment atrepl
atterminal
? - What does
...
mean atterminal
when runningnodejs
? - How to run JavaScript commands at terminal with
nodejs
, including for example destructuring assignment; default parameters; defining and calling functions; other common usages, which do not result in...
? - How to correctly build
V8
for purpose of running JavaScript atterminal
?
via guest271314
No comments:
Post a Comment