# 定義

TIP

陳述式(Statement):不會回傳結果

表達式(Expression):會回傳結果

# 陳述式(Statement)

var name;//undefined
for(let i=0 i<10; i++){

}//Uncaught SyntaxError: Unexpected identifier

# 表達式(Expression)

name = 'John';//"John"
1+1//2

# 函式陳述式(Function Statement)、具名函式(Named Functions)

function total(){

}

# 函式表達式(Function Expression)、匿名函式(Anonymous Functions)

var name = function(){

}

# 物件實字(Object literal)

var animal = {
    name: 'cat',
}

參考文獻:
JavaScript 核心篇 (opens new window)

Initializing...

Last Updated: 2021-01-05 18:16