JavaScript

detect Types & Properties

 

How to Detect?

  • Primitive types
  • Custom types
  • Array
  • Function
  • Properties in Object

Primitive types

Number, Boolean, String

Null, Undefined

Custom types

function Car(){

this.run="booboo";

}

Array

function isArray(arr){

arr.length ?

???

}

Function

function isFunction(arr){ ?

???

}

Properties in Object

Is that correct?

if(obj.prop)

if(obj.prop == true)

if(typeof obj.prop === "undefined")

Text

JavaScript Detect Types & Properities

By Jayden Lin

JavaScript Detect Types & Properities

  • 786