close

JavaScript是一個程式語言
並且用分號";"來分別敘述

Statements 敘述
由Values(值), Operators(運算子), Expressions(表達式),
Keywords(關鍵字), 和Comments(註解)組成

Values 值
分成兩種,
Fixed calues(固定值)稱為 literals字面
Variable values(變動值)稱為 variables變數

Literals 字面
Numbers(數字)分成小數(decimals)或非小數兩種
ex: 10.50 或1001

Strings 字串
可用雙引號或單引號來表示
ex: "John Doe", 'John Doe'

Variables 變數
用var來宣告變數,用等號"="來給值
ex: 
var x;
x = 6;

Operators 運算子
+,-,*,/等等

Expressions 表達式
由變數, 運算子, 或呼叫方法來組成的合法句子

Keywords 關鍵字
Javascript已經定義好功能的字
ex: var

Comments 註解
單行可用 // 
範圍則用 /* */

Identifiers 識別碼
不能用數字開頭
但是可以用_或$來做變數命名

最後,Javascript使用Unicode, 並且大小寫是有分別的
JavaScript uses the Unicode character set. and is Case Sensitive.

 

1. 官網 http://www.w3schools.com/js/js_syntax.asp

01.png  

arrow
arrow
    創作者介紹
    創作者 RX1226 的頭像
    RX1226

    給你魚竿

    RX1226 發表在 痞客邦 留言(0) 人氣()