javascript - typeof Float32Array With Ternary Operator Syntax -
I am trying to understand code and one of the first lines is confusing me:
< Pre> FSS.Array = typeof Float32Array === 'function'? Float 32 Oops: Array;
What happens above this line?
I believe: In the end it is saying "if something float is equal to 32 arrays, and equal is equal". But I do not think what kind of float 32 array === 'function' works, is it saying that the type float 32 array is equal to string 'function'? I do not understand this.
The code is being checked for browser support for the javascript function Float32Array
Ternary Expression Is similar to:
if (float32Array == "type of function") {FSS.Array = Float32Array; } Else {FSS.Array = Array; }
Type type returns only the type of variable, in this case the variable "Float32Array"
are types of documents:
docs Here are some other examples from:
// Type of number 37 === 'number'; Type 3.14 === 'number'; Type of monastery LN2 === 'number'; Typef Infinity === 'number'; Type NAN === 'number'; // "no-no-number" type number (1) === despite being 'number'; // Never use this form! // string type "" === 'string'; Type "bla" === 'string'; Typef (typef1) === 'string'; // Type always type a letter of the string ("abc") === 'string'; // Never use this form! // boolean type true === 'boolean'; Wrong type === 'boolean'; Boolean type (true) === 'boolean'; // Never use this form! // Symbol type symbol () === Symbol of type 'symbol' type ('foo') === Symbol of 'symbol' type Prohibited === 'symbol' // undefined type undefined === 'undefined'; Type blah === 'undefined'; // An undefined variable / type of object {a: 1} === 'object'; // Use & lt; A href = "/ en-us / docs / web / javascript / context / global_object / array / isArray" title = "/ N-US / Docs / Web / JavaScript / Reference / global_object / array / ISARA" & gt; Array.isArray & lt; / A & gt; Or Object.prototype.toString.call // to isolate regular objects from array type [1, 2, 4] === 'object'; New date type () === 'object'; // Do not use the following is misleading! New Boolean type (true) === 'object'; Type of new number (1) === 'object'; New string types ("ABC") === 'Object'; // Work type work () {} === 'function'; Math.sin === Types of 'Functions';
Comments
Post a Comment