厚著臉皮跑去參加柯P健走活動,11/22(六) 600NT,上午八點半到十二點
這篇滿有趣的,我喜歡她所說美國人不要別人的結論
今天以悠哉地讀這篇文章作開始
由於要寫loop runner要理解JavaScript的function邏輯(跟我習慣的C、JAVA的不太一樣),所以回去讀底層JavaScript想了解始末,另外也找了一些JavaScript裡的requestAnimationFrame的資料
這篇不錯,由淺入深並且詳述為何不要用setInterval與setTimeout。
這篇不錯,由淺入深並且詳述為何不要用setInterval與setTimeout。
學而知不足,回頭去讀Functions :: Eloquent JavaScript讀到lexical scoping時一直難有體會,後來估狗找到這篇時,再去回想C語言的function寫法,終於有所感受
為了value一詞,回去讀Values, Types, and Operators :: Eloquent JavaScript, 裡頭有著下面一段敘述
對於function的用法,我很喜歡Functions :: Eloquent JavaScript裡頭summary所寫的這段話
至於什麼是expression,什麼又是statement,我又回頭去讀Eloquent JavaScript的CH2
簡單來說,function裡面的code可以操作funtion外面的variable,可以從下面這一個網站的第一個demo code看出相同的結論
var sayHi = function (){...}上面的sayHi就是我們的function value,這是expression的寫法
function fuckU(){...}這是在說,declare fuckU to be a function,這是statement的寫法,注意fuckU一詞在此是一個variable。
- A function value can do all the things that other values can do—you can use it in arbitrary expressions, not just call it. It is possible to store a function value in a new place, pass it as an argument to a function, and so on.
為了value一詞,回去讀Values, Types, and Operators :: Eloquent JavaScript, 裡頭有著下面一段敘述
- To be able to work with such quantities of bits without getting lost, you can separate them into chunks that represent pieces of information. In a JavaScript environment, those chunks are called values. Though all values are made of bits, they play different roles. Every value has a type that determines its role. There are six basic types of values in JavaScript: numbers, strings, Booleans, objects, functions, and undefined values.
對於function的用法,我很喜歡Functions :: Eloquent JavaScript裡頭summary所寫的這段話
- The function keyword, when used as an expression, can create a function value. When used as a statement, it can be used to declare a variable and give it a function as its value.
至於什麼是expression,什麼又是statement,我又回頭去讀Eloquent JavaScript的CH2
好累,現在臨晨三點半,剩下的明天補齊
沒有留言:
張貼留言