[Learning] #19 JS: Modified functions & how function create spaces

Modified functions(變形函式)

Before introducing modified function, let’s recall our memory about the “basic function”:

And this is how a modified function look like:

The meanings behind these two functions are actually the same, but the modified one input the function into the variable. We can say that function is a kind of data as well.

Function block creates space

  • With function block, it creates a new space for coding.
  • 2 spaces: global variable(全域變數 or 全域空間) and local variable(區域變數 or 區域空間)

External code can not use the local variable, but local variable can use global variable.
For example, if we don’t declare the x variable at local variable, var x=13 will still be operated right away.

Music of Today: Hymn For The Weekend by Coldplay

PM, Relationship, Travel, or anything quirky but interesting.|Subscribe & buy Vida a drink @LikerLand, the bottom of each article. 在文章底下LikerLand訂閱、請Vida喝一杯飲料 ❤