return String vs Integer vs undefined vs null

后端 未结 6 1751
醉话见心
醉话见心 2021-02-15 10:50

Why does javascript prefers to return a String over any other choices ?

Consider the following snippet.

var arr = [\'Hello1\', \'Hello2\', \         


        
6条回答
  •  野的像风
    2021-02-15 11:11

    return this[x] || null || 'aïe' || 12 || undefined will not return one of those. It is supposed to return the result of the expression this[x] || null || 'aïe' || 12 || undefined - I believe it will return a boolean value.

提交回复
热议问题