51300520
V2EX  ›  问与答

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

  •  
  •   51300520 · Aug 17, 2019 · 2258 views
    This topic created in 2586 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   ·   Privacy   ·   Solana   ·   4034 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 05:31 · PVG 13:31 · LAX 22:31 · JFK 01:31
    ♥ Do have faith in what you're doing.