[AppleScript] 纯文本查看 复制代码
// Numberstypeof 37 === 'number';
typeof 3.14 === 'number';
typeof(42) === 'number';
typeof Math.LN2 === 'number';
typeof Infinity === 'number';
typeof NaN === 'number';
// Despite being "Not-A-Number"
typeof Number(1) === 'number';
// but never use this form! // Strings
typeof "" === 'string';
typeof "bla" === 'string';
typeof (typeof 1) === 'string';
// typeof always returns a string
typeof String("abc") === 'string';
// but never use this form! // Booleans
typeof true === 'boolean';
typeof false === 'boolean';
typeof Boolean(true) === 'boolean';
// but never use this form! // Symbols
typeof Symbol() === 'symbol'
typeof Symbol('foo') === 'symbol'
typeof Symbol.iterator === 'symbol'
// Undefinedtypeof undefined === 'undefined';
typeof declaredButUndefinedVariable === 'undefined';
typeof undeclaredVariable === 'undefined';
// Objectstypeof {a:1} === 'object';
// use Array.isArray or Object.prototype.toString.call
// to differentiate regular objects from arrays
typeof [1, 2, 4] === 'object';
typeof new Date() === 'object';
// The following is confusing. Don't use!
typeof new Boolean(true) === 'object';
typeof new Number(1) === 'object';
typeof new String("abc") === 'object';
// Functionstypeof function(){} === 'function';
typeof class C {} === 'function';