I came across this while learning about child processes:
const {spawn} = require('child_process');
My question is, what is the difference between the above and this:
const spawn = require('child_process');
I came across this while learning about child processes:
const {spawn} = require('child_process');
My question is, what is the difference between the above and this:
const spawn = require('child_process');
The 1st extracts spawn variable from inside child_proccess.
This only unpack value of spawn from child_proccess instead of the whole module.
The 2nd sets spawn variable the entire child_process module (as a whole).