why are objects wrapped in parenthesis in JS?

后端 未结 3 1125
隐瞒了意图╮
隐瞒了意图╮ 2020-12-17 00:57

Given the following example:

var foo = {
    root:
        ({
            key1: \"Value1\",
            key2: \"Value2\",
            key3: \"Value3\"
               


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-17 01:12

    They do nothing :) They're there for readability, although it's questionable if they achieve that aim.

提交回复
热议问题