New Blog (Beta)
https://grimmer.netlify.com
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
物件的使用:
物件(ES5)的member function (method)宣告方式:
Person.prototype.sayHello = function()
in constructor:
function Person (){
this.testFun = function{
} }
key/value:
var myObj = { myMethod: function(params) { // …do something } }
Class.method = function ()
. It has no relationship with an object instance of that constructor functionfunction expressions/Function declaration:
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:
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/js_function_invocation.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/js_function_closures.asp
A closure is a function having access to the parent scope, even after the parent function has closed.
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
Leave a Comment