cocos-js判断类型

来源:互联网 发布:希腊罗马神话 知乎 编辑:程序博客网 时间:2024/06/06 04:56

CCBoot.js

cc.isString = function(obj) {    return typeof obj === 'string' || Object.prototype.toString.call(obj) === '[object String]';};
cc.isArray = function(obj) {    return Array.isArray(obj) ||        (typeof obj === 'object' && Object.prototype.toString.call(obj) === '[object Array]');};
cc.isFunction = function(obj) {    return typeof obj === 'function';};



cc.isObject = function(obj) {    return typeof obj === "object" && Object.prototype.toString.call(obj) === '[object Object]';};
等等……
1 0
原创粉丝点击