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

前端 未结 7 650
一向
一向 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:13

    1. In JavaScript, functions are first class objects. You could store them in objects (variables) and pass them as arguments to functions. Every function is actually a Function object.

    2. gol is an object, which is being initialized using the object literal notation.

提交回复
热议问题