How can I pass a parameter to a function without it running right away?

前端 未结 3 557
面向向阳花
面向向阳花 2020-12-03 01:30

I\'m having somewhat of an odd issue with trying to piece together a somewhat dynamic Google Maps display. I have overlays on a map that I would like to call a function when

3条回答
  •  不思量自难忘°
    2020-12-03 01:50

    myFunction(msg) {console.log(msg)} // example function
    
    myFunction('hello world') // myFunction called "immediately"
    
    () => myFunction('hello world') // myFunction not called here; returns myFunction
    
    function() { return myFunction('hello world') } // myFunction not called here; returns myFunction
    

提交回复
热议问题