I can't understand the application of comma operator. I'd like to get an answer (0, function) (args)).

I"m looking at the source code of warriorjs (a programmed Mini Game). The code
const {directory, level, time, yes} = (0, _ parseArgs2.default) (args);
) puzzles me very much. The comma operator only returns the rightmost value in the end, so what"s the meaning of 0, and what can"t he express as an expression? When searching for
, I found that someone had asked the same question in the past, but I didn"t get an answer, so I linked to
react-redux source code?

I hope some boss can solve the confusion in my heart, thank you!

Mar.16,2021

personal understanding: the question of
is actually equivalent to (0, _ parseArgs2.default) (args) ) and _ parseArgs2.default (args) . What's the difference?
my first thought is about this .

(0, _parseArgs2.default)(args)
// 
let fun = (0, _parseArgs2.default)
fun(args) 
When the code snippet above is executed, this in the function equals undefined in strict mode and window in non-strict mode.

_parseArgs2.default(args)
When the code snippet above is executed, the this in the function points to _ parseArgs2 ; the example of
is as follows:

clipboard.png

Update:
js:
clipboard.png

Menu