javascript中的排序: 1.不同类型 比 类型 (字符串 > 数字)   2.同类型:(字符串  比 按字母顺序 )(数字 比 大小)

测试:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Javascript typeof</title>
</head>
<body> <script type="text/javascript">
var a = "11111";
var b = "22222";
var c = 22222;
var str = 'string'; var s1 = "abb";
var s2 = "abcd";
var s3 = "-"; console.log('typeof', typeof a);
console.log('typeof b', typeof b);
console.log('typeof c', typeof c);
console.log('typeof b > typeof c', typeof b > typeof c);
console.log('typeof a === typeof b', typeof a === typeof b);
console.log('typeof a === typeof c', typeof a === typeof c);
console.log('typeof a === str', typeof a === str);
console.log('a-b', a-b);
console.log('a-c', a-c);
console.log('s1-s2', s1-s2);
console.log('s1>s2 ?', s1>s2);
console.log('s1<s2 ?', s1<s2); console.log('parseInt(s1)', parseInt(s3));
console.log('parseFloat(s1)', parseFloat(s3));
console.log('Number(s1)', Number(s3)); console.log('a-0', a-0);
console.log('s3-0', s3-0); </script> </body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Javascript typeof</title>
</head>
<body> <script type="text/javascript">
var a = "11111";
var b = "22222";
var c = 22222;
var str = 'string'; var s1 = "abb";
var s2 = "abcd";
var s3 = "-"; console.log('typeof', typeof a);
console.log('typeof b', typeof b);
console.log('typeof c', typeof c);
console.log('typeof b > typeof c', typeof b > typeof c);
console.log('typeof a === typeof b', typeof a === typeof b);
console.log('typeof a === typeof c', typeof a === typeof c);
console.log('typeof a === str', typeof a === str);
console.log('a-b', a-b);
console.log('a-c', a-c);
console.log('s1-s2', s1-s2);
console.log('s1>s2 ?', s1>s2);
console.log('s1<s2 ?', s1<s2); console.log('parseInt(s1)', parseInt(s3));
console.log('parseFloat(s1)', parseFloat(s3));
console.log('Number(s1)', Number(s3)); console.log('a-0', a-0);
console.log('s3-0', s3-0); </script> </body>
</html>

输出结果:

最新文章

  1. Javascript for循环指定锚点跳转
  2. python字符串及其方法详解
  3. WebDriver一些常见问题的解决方法【转】
  4. Linux 学习笔记 Linux环境变量初稿
  5. C#键盘事件处理(来源网上)
  6. python之字符串详解2
  7. iView的使用【CDN向】
  8. Linq 实例
  9. 应付模块的R12 TRACE 和 FND Debug 文件 / FND 日志 调试
  10. Vue-input框checkbox强制刷新
  11. python中type、class、object之间的关系
  12. leetcode437--Path Sum III
  13. Docker(二十七)-Docker 清理占用的磁盘空间
  14. 关于linux上cron服务的python封装工具
  15. ios ideviceintaller安装
  16. 10.9zuoye
  17. list页面-按照choice筛选丶传condition过滤筛选项丶筛选与显示同步
  18. BasicAuth和OAuth
  19. swiper中有视频时,滑动停止后视频停止播放
  20. Scrum Meeting Beta - 2

热门文章

  1. 第一百三十八节,JavaScript,封装库--插件
  2. python 多线程糗事百科案例
  3. [转]SpecFlow使用入门
  4. php中数组中&amp;的问题
  5. RAC集群节点故障模拟测试
  6. java获取系统时区
  7. 模拟ORA-26040: Data block was loaded using the NOLOGGING option
  8. jacob操作 office 内部对应代码
  9. 【BZOJ2179】FFT快速傅立叶
  10. 网络模型+三次握手+四次挥手+DNS+HTTPS