Object Literal Property Value Shorthand

前端 未结 2 413
悲&欢浪女
悲&欢浪女 2021-01-21 15:09

When creating JavaScript factory functions I was taught that the return syntax looks like the below:

function FF(constructorArg) {
   var _privateName = construc         


        
2条回答
  •  無奈伤痛
    2021-01-21 15:58

    This is new es6 syntax. Only some browsers will support it unless you are compiling to es5. See the compatibility table: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer

提交回复
热议问题