What do you call this JavaScript syntax, so I can research it?

前端 未结 7 606
一向
一向 2020-12-18 00:57

1) In the following code, what is the reasoning behind making gameOfLive a variable and not just function gameOfLife()?

2) What is go

7条回答
  •  感情败类
    2020-12-18 01:16

    Putting a function in a variable allows you to come along later and replace it with another function, replacing the function transparently to the rest of your code. This is the same thing you're doing when you specify "onClick=" on a form widget.

提交回复
热议问题