Javascript中数据类型及其判别方法(typeof instanceof Object.prototype.toSting.call(obj)的区别)
来源:互联网 发布:grid.base.js 编辑:程序博客网 时间:2024/04/30 08:33
今天总结了一下js中常见的数据类型及其判断方法如下,有错误欢迎指正:
以及一些实验性的例子如下:
function ha(){var str="1234";}var ha3 = ha;var ha4 = function(){};document.write(typeof(ha));//functiondocument.write(typeof ha3);//functiondocument.write(typeof ha4);//functiondocument.write(typeof ha12);//undefineddocument.write(typeof ha());//undefineddocument.write(typeof NaN);//Numberdocument.write(typeof NaN==NaN);//falsedocument.write(ha() == undefined);//truedocument.write(0 == true);//falsevar num=86;var num2 = num;document.write(typeof num2); numberfunction Book(_name,_money){this._name = _name;this._money = _money;}var book = new Book("hah",30);document.write(book instanceof Book);//truevar para = new String("123");var type = Object.prototype.toString.call(book);//[Object Object]//var type = Object.prototype.toString.call(para);//[Object String]document.write(type);var test = Object.create(null);document.write(test instanceof Object);//falsedocument.write(typeof test);//object
0 0
- Javascript中数据类型及其判别方法(typeof instanceof Object.prototype.toSting.call(obj)的区别)
- js中判断数据类型的属性typeof、instanceof、 constructor、 prototype
- 判断变量的类型(typeof、instanceof、Object.prototype.toString)
- typeof、instanceof、Object.prototype.toString.call() 区分对象类型
- typeof,instanceof,Object.prototype.toString.call(),js内置对象
- JavaScript中typeof和instanceof的区别
- JavaScript 中typeof与instanceof的区别
- JavaScript中typeof与instanceof的区别
- JavaScript中instanceof和typeof的区别
- JavaScript 中 typeof 和 instanceof 的区别
- JavaScript中typeof和instanceof的区别
- js判断对象类型 typeof与Object.prototype.toString.call方法的区别
- typeof,instanceof,Object.prototype.toString来判断数据类型
- javascript中判断数据类型的四种方法及typeof、instanceof、constructor、toString
- js 检测数据类型instanceof/constructor和 Object.prototype.toString.call()
- js中精确判断对象类型--关于typeof 和Object.prototype.toString方法的区别
- 利用Object.prototype.toString.call(obj)判断数据类型
- Javascript中typeof与instanceof之间的区别
- GetWords
- 【JAVA笔记——道】Hibernate 线程本地化基础篇
- basket nike pas cher adjustable dumbbells are the answer.
- jdbcTemplate与hibernateTemplate混用
- chaussures nike ensuring superior engineering in their headphones down to the smallest detail.
- Javascript中数据类型及其判别方法(typeof instanceof Object.prototype.toSting.call(obj)的区别)
- air max pas cher Tiongkok tendance au refroidissement
- nike femme See next point
- Codeforces 104C Cthulhu dfs暴力 || 点双连通缩点
- LeetCode 60 Reverse Linked List II
- mini2440使用jlink烧写superboot到norflash
- RabbitMQ学习(四).NET Client之Routing
- 每天进步一点点——Linux中的文件描述符与打开文件之间的关系
- 智能指针之辅助类