51300520
V2EX  ›  问与答

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

  •  
  •   51300520 · Aug 17, 2019 · 2086 views
    This topic created in 2481 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   ·   1348 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:48 · PVG 07:48 · LAX 16:48 · JFK 19:48
    ♥ Do have faith in what you're doing.