``````x += 23; // x = x + 23;
y -= 15; // y = y - 15;
z *= 10; // z = z * 10;
k /= 7; // k = k / 7;
p %= 3; // p = p % 3;
d **= 2; // d = d ** 2;
m >>= 2; // m = m >> 2;
n <<= 2; // n = n << 2;
n ++; // n = n + 1;
n --; n = n - 1;

``````

### `++` 和 `--` 運算子

``````var a = 2;
var b = a++;
// 現在 a 是 3 然後 b 是 2
``````

`a++` 執行以下的操作：

1. 回傳 `a` 的數值
2. `a` 加 1

``````var a = 2;
var b = ++a;
// 現在 a 和 b 都是 3
``````

`--` 運算子也是類似的，用來遞減數值。

### If-else （使用三元運算符）

``````var newValue;
if (value > 10)
newValue = 5;
else
newValue = 2;
``````

``````var newValue = (value > 10) ? 5 : 2;
``````

### Null、Undefined、Empty 確認

``````if (variable1 !== null || variable1 !== undefined || variable1 !== '') {
var variable2 = variable1;
}
``````

``````var variable2 = variable1  || '';
``````

P.S.：假設 variable1 是數字，首先會檢查是否為 0 。

### 物件陣列表示

``````var a = new Array();
a[0] = "myString1";
a[1] = "myString2";
``````

``````var a = ["myString1", "myString2"];
``````

### 關聯陣列

``````var skillSet = new Array();
skillSet['Document language'] = 'HTML5';
skillSet['Styling language'] = 'CSS3';
``````

``````var skillSet = {
'Document language' : 'HTML5',
'Styling language' : 'CSS3'
};
``````