e-book Link: https://grimmer0125.gitbooks.io/learning-javascript/content/
http://www.w3schools.com/js/js_arrays.asp
JavaScript does not support arrays with named indexes.
->可能會誤解, 至少 JavaScript Object 就看起來等於是named indexed了. http://www.vixual.net/blog/archives/31
JavaScript教學 - 變數(Variables) http://emn178.pixnet.net/blog/post/94806770-javascript%E6%95%99%E5%AD%B8---%E8%AE%8A%E6%95%B8(variables)
How do you check if a variable is an array in JavaScript? http://stackoverflow.com/questions/767486/how-do-you-check-if-a-variable-is-an-array-in-javascript
How to check for “undefined” in JavaScript?
http://stackoverflow.com/questions/3390396/how-to-check-for-undefined-in-javascript
if (aa.bb) -> if bb is not declared yet , will not throw exceptions
but
if (aa) -> if aa is not declared yet, will throw exceptions.
JavaScript Hoisting, JavaScript Declarations are Hoisted, 先使用之後才var http://www.w3schools.com/js/js_hoisting.asp
你所想像不到的 JavaScript:
http://www.vixual.net/blog/archives/31
strict mode: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
module pattern & immediately invoked function expression
https://toddmotto.com/mastering-the-module-pattern/
about multi thread:
JavaScript 物件導向介紹
https://developer.mozilla.org/zh-TW/docs/JavaScript_%E7%89%A9%E4%BB%B6%E5%B0%8E%E5%90%91%E4%BB%8B%E7%B4%B9
物件的使用:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
物件(ES5)的member function (method)宣告方式:
non static method: Person.prototype.sayHello = function()
in constructor:
function Person (){
this.testFun = function{
}
}
key/value:
var myObj = { myMethod: function(params) { // …do something } }
static: Class.method = function ()
. It has no relationship with an object instance of that constructor function
http://ithelp.ithome.com.tw/question/10128721
function expressions/Function declaration:
定義 JavaScript 函數(Functions)的各種方式 (非指member function) http://blogger.gtwang.org/2014/04/defining-javascript-functions.html
http://stackoverflow.com/questions/16439949/define-local-function-in-javascript-use-var-or-not
es5 singleton
http://stackoverflow.com/questions/1479319/simplest-cleanest-way-to-implement-singleton-in-javascript/1479341#1479341
簡單理解 JavaScript 的記憶體管理機制
http://fred-zone.blogspot.tw/2012/05/javascript_22.html
JavaScript Scope
http://www.w3schools.com/js/js_scope.asp
scope, 變數範圍, 有提前講到 ES6的let (block scope) https://msdn.microsoft.com/zh-tw/library/bzt2dkta(v=vs.94).aspx
this
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
call:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
this, bind
this, strict mode https://dotblogs.com.tw/blackie1019/archive/2013/08/30/115977.aspx
this, JavaScript Function Invocation http://www.w3schools.com/js/jsfunctioninvocation.asp
this, JavaScript 的 this
是指什麼?
http://dreamerslab.com/blog/tw/javascript-this/
this, JavScript:this用法整理, 超重要
http://crazyalu-blog.logdown.com/posts/209938—javascriptthis-use-finishing
closure:
http://www.w3schools.com/js/jsfunctionclosures.asp
A closure is a function having access to the parent scope, even after the parent function has closed.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures !!!!
http://dreamerslab.com/blog/tw/javascript-function-scopes-and-closures/ !!
http://ithelp.ithome.com.tw/articles/10131469 timer !!! 特殊的case2 !!! 可用ES6的let解
http://cythilya.blogspot.tw/2015/06/javascript-module-pattern.html
ES6, classes
http://www.codedata.com.tw/javascript/es6-4-maximally-minimal-classes/
ES6, Arrow function
https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions
ES6 Preview
http://weichienhung.github.io/blog/2014/03/12/es6-preview/
ES6 features https://github.com/lukehoban/es6features
ES6 簡化的member function寫法
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions
class MainPage extends React.Component {
handleChange() {
}
}
ES7 (draft)
http://stackoverflow.com/questions/32540181/should-i-put-a-semicolon-after-es7-decorators
ES7, spreading operator:
c = {...a, ...b}
test code 1:
if(true)
{
var testlocal = "123";
}
接著印 testlocal 有值
test code 2:
function func2() {
var L = 'local';
G = 'global';
}
沒有call的話都沒值 但如果有call func2 則G有值!!!!!! ->會變成global object下面的property2
特殊 case :
var a = 1;
(function(){
console.log(a); // ? -> undefined
var a = 100;
console.log(a); // 100
})();
因為在匿名函數獨立的 scope 內,不管 var 是放在最前面,或是最後一行,他的變數實體在該 code block 一開始就是新的了,也就是說,剛剛的 code 其實等同下面這段:
(function(){
var a;
console.log(a);
..
})();
Node.js bug:
Why does the value of typeof null change inside a loop? V8 engine bug.
http://stackoverflow.com/questions/37939455/why-does-the-value-of-typeof-null-change-inside-a-loop