How do I compute a variable in JavaScript if and only if it is used?

后端 未结 0 1638
独厮守ぢ
独厮守ぢ 2021-02-15 04:45

This is what I\'m doing right now.

var foo = function() {
  var x = someComplicatedComputationThatMayTakeMoreTime();
  this.foo = function() { return x; };
  ret         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题