跳轉到內容

JavaScript/保留字/typeof

來自華夏公益教科書,自由的教科書
上一個: try 保留字 下一個: var

Thetypeof關鍵字

[編輯 | 編輯原始碼]

Thetypeof關鍵字是一個一元運算子,它返回一個字串,該字串給出引數的型別。

  typeof[(]expression[)];

該運算子返回六個值,它們是boolean, function, number, object, string,和undefined.

  theArray = new Array();
  if (typeof(theArray) == 'object') {
    []
  }
上一個: try 保留字 下一個: var
華夏公益教科書