0

Hello I am a newbie to JS and Node, I am making an application that should return the NodeJS version and V8 Version using process.versions(), but this will return a JSON formatted-output, but I only need the value of v8 and node, so how can I do this?

  • [`process.versions`](https://nodejs.org/api/process.html#processversion) (not a function btw) returns an object. So `process.versions.node` etc will work. – Andy Oct 24 '21 at 07:10
  • Here the documentation on versions in [Node.js](https://nodejs.org/docs/v0.10.12/api/process.html#process_process_version) – Karl H Oct 24 '21 at 07:19

1 Answers1

0

Use destructuring

const {node ,v8}=process.versions
console.log(node);
console.log(v8);

See repl

Shubham Dixit
  • 9,242
  • 4
  • 27
  • 46