經過Obecjt.prototype.toString()來自動檢測類型prototype
function checkType(ele){ return Object.prototype.toString.call(ele) .replace(/[\[\]]/g,'').split(' ')[1] .toLowerCase(); }
toString的返回值有哪幾種code
Null; Undefined; String; Number; Boolean; Objectit
Arguments; Array; Date; Error; Function; JSON; Math; RegExpio