51300520
V2EX  ›  问与答

javascript 花括号那种对象和 function 好像可以混用,用种好点?

  •  
  •   51300520 · Aug 17, 2019 · 2177 views
    This topic created in 2539 days ago, the information mentioned may be changed or developed.

    区别好像就是一个有 prototype 一个没有,其他好像可以混用 return {a:1,b:2}和 var v=function(){this.a=1; this.b=2} return new v() 好像是一样的,一般用哪种好点?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1114 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 17:58 · PVG 01:58 · LAX 10:58 · JFK 13:58
    ♥ Do have faith in what you're doing.