[About ES5]What's diff btw these two functions below?

igoist
  • 52
var a1 = function (args) {
};

var a2 = function b (args) {
};

More explicit example about using the lib Three.js:
a1

cljs_exp.core.particleRender = (function cljs_exp$core$particleRender(context){
  context.beginPath();
  ...
  return context.fill();
});

a2

cljs_exp.core.particleRender = (function(context) {
  context.beginPath();
  ... 
  return context.fill();
});

And parse the param a1 or a2, will get different result.

var material_11537 = (new THREE.ParticleCanvasMaterial((function() {
  var obj11536 = {
    "color": cljs_exp.core.getRandomColor.call(null),
    "program": ** * cljs_exp.core.particleRender ** *
  };
  return obj11536;
})()));
回复
阅读 849
1 个回答
✓ 已被采纳
a1.name    // a1
a2.name    // b

if cljs_exp.core.particleRender is just a simple function, I think it won't get difference result.


        var material = new THREE.ParticleCanvasMaterial({
            color: 0xe1e1e1,
            program: function(context) {
                context.beginPath();
                context.arc(0, 0, .6, 0, PI2, true);
                context.fill();
            }
        });
        
        
        var material = new THREE.ParticleCanvasMaterial({
            color: 0xe1e1e1,
            program: function somename(context) {
                context.beginPath();
                context.arc(0, 0, .6, 0, PI2, true);
                context.fill();
            }
        });
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏