Why does this JavaScript work?

前端 未结 4 1368
难免孤独
难免孤独 2021-01-17 08:27

I was looking at the output of some stuff from UglifyJS and happened across some code like the following:

var a = 0;
var b = function () {
    return functio         


        
4条回答
  •  终归单人心
    2021-01-17 09:03

    The result of an expression using the comma operator is the right hand side of the comma operator.

    You have:

    return a_function_call(), a_string
    

    … so you get a_string assigned.

提交回复
热议问题