代码心得

1.尽量物件导向化(例如在function内用  this.xxx = xxx)

2.变数尽量简洁、unused的删掉。

3.逻辑判断要清楚

4.应该做个双向绑定,例如可以输入生日,来测试情况

 

Vue.js

Vue.js給我的感覺是,將一組HTML物件化起來,定義它的方法、資料。

jQuery則是一開始使用 selector 找到物件,再定義要他們幹麻幹麻。

all Vue components are also Vue instances

Declarative vs Imperative Programming

https://codeburst.io/declarative-vs-imperative-programming-a8a7c93d9ad2

http://www.redotheweb.com/2015/09/18/declarative-imperative-js.html

https://msdn.microsoft.com/zh-tw/library/ff750239.aspx

https://msdn.microsoft.com/zh-tw/library/ff750239.aspx

https://stackoverflow.com/questions/33655534/difference-between-declarative-and-imperative-in-react-js

JavaScript let

if (true) {
 let a = 40;
 console.log(a); //40
}
console.log(a); // undefined

上面的范例,如果改成var的话,最下面一行的console.log(a); 却是可以获取到的(40)