<html>
<head>
<title>javascript基础</title>
</head> <body>
1.NaN isNaN()</br>
<script type="text/javascript">
//数据类型转换失败 返回NaN类型
document.write("parseInt('a') : " ,parseInt('a'),"<br/>");
document.write("parseInt('9') : " ,parseInt('9'),"<br/>");
document.write("NaN == NaN : " , NaN == NaN,"<br/>");
</script> 2.关系运算符 > >= < <= != == ===</br>
<script type="text/javascript">
document.write("'7' < 5 : " ,'7' < 5,"<br/>");//发生类型转换
document.write("'7' > 5 : " ,'7' > 5,"<br/>");
document.write("'7' > '12' : " ,'7' > '12',"<br/>");//不发生类型转换
document.write("'a' > 12 : " ,'a' > 12,"<br/>");//发生类型转换
document.write("'a' < 12 : " ,'a' < 12,"<br/>");//发生类型转换
document.write("isNaN('a') : " ,isNaN('a') ,"<br/>");//是否是非数字
document.write("isNaN('8') : " ,isNaN('8') ,"<br/>"); document.write("100 == '100' : " , 100 == '100' ,"<br/>");
document.write("100 === '100' : " , 100 === '100' ,"<br/>");//值相等 类型相同
document.write("'100' === '100' : " , '100' === '100' ,"<br/>");
</script> 3.赋值运算符 = += -= *= /= %=</br> 4.逻辑运算符 !&& ||</br>
<script type="text/javascript">
//任何类型使用!结果是布尔型 true --- null '' 0 undefined
document.write("!true : " , !true ,"<br/>");
document.write("!5 : " , !5 ,"<br/>");
document.write("!0 : " , !0 ,"<br/>");
document.write("!-2 : " , !-2 ,"<br/>");
document.write("!null : " , !null ,"<br/>");
document.write("!new Date() : " , !new Date() ,"<br/>");
</script> 5.类型转换</br>
<script type="text/javascript">
document.write("parseInt('123') : " ,parseInt('123'),"<br/>");
document.write("parseInt('123a') : " ,parseInt('123a'),"<br/>");
document.write("parseInt('a123') : " ,parseInt('a123'),"<br/>");
document.write("parseInt('123.456') : " ,parseInt('123.456'),"<br/>"); document.write("parseFloat('123.456') : " ,parseFloat('123.456'),"<br/>");
document.write("parseFloat('123.456.789') : " ,parseFloat('123.456.789'),"<br/>");
document.write("parseFloat('123.a.789') : " ,parseFloat('123.a.789'),"<br/>");
document.write("parseFloat('a123.789') : " ,parseFloat('a123.789'),"<br/>");
var a = 20;
var b = 50;
document.write("a + b = " ,a + b,"<br/>");
document.write("a.toString() + b = " ,a.toString() + b,"<br/>"); document.write("'10' + b = " ,'10' + b,"<br/>");//字符串 连接
document.write("'10' - b = " ,'10' - b,"<br/>");//类型转换 进行计算
document.write("'a' - b = " ,'a' - b,"<br/>");
</script>
</body> </html>

结果:

2.

javascript 基础1第11节的更多相关文章

  1. 学习javascript基础知识系列第二节 - this用法

    通过一段代码学习javascript基础知识系列 第二节 - this用法 this是面向对象语言中的一个重要概念,在JAVA,C#等大型语言中,this固定指向运行时的当前对象.但是在javascr ...

  2. Android零基础入门第11节:简单几步带你飞,运行Android Studio工程

    原文:Android零基础入门第11节:简单几步带你飞,运行Android Studio工程 之前讲过Eclipse环境下的Android虚拟设备的创建和使用,现在既然升级了Android Studi ...

  3. javascript 基础3第13节

    <html> <head> <title>javascript基础</title> </head> <body> 1.流程控制 ...

  4. javascript 基础2第12节

    1. <html> <head> <title>javascript基础</title> </head> <body> 1.Nu ...

  5. Android零基础入门第29节:善用TableLayout表格布局,事半功倍

    原文:Android零基础入门第29节:善用TableLayout表格布局,事半功倍 前面学习了线性布局和相对布局,线性布局虽然方便,但如果遇到控件需要排列整齐的情况就很难达到要求,用相对布局又比较麻 ...

  6. Android零基础入门第30节:两分钟掌握FrameLayout帧布局

    原文:Android零基础入门第30节:两分钟掌握FrameLayout帧布局 前面学习了线性布局.相对布局.表格布局,那么本期来学习第四种布局--FrameLayout帧布局. 一.认识FrameL ...

  7. Android零基础入门第28节:轻松掌握RelativeLayout相对布局

    原文:Android零基础入门第28节:轻松掌握RelativeLayout相对布局 在前面三期中我们对LinearLayout进行了详细的解析,LinearLayout也是我们用的比较多的一个布局. ...

  8. Android零基础入门第26节:layout_gravity和gravity大不同

    原文:Android零基础入门第26节:layout_gravity和gravity大不同 上一期我们一起学习了LinearLayout线性布局的方向.填充模型和权重,本期来一起学习LinearLay ...

  9. Android零基础入门第27节:正确使用padding和margin

    原文:Android零基础入门第27节:正确使用padding和margin 前面两期我们学习了LinearLayout线性布局的方向.填充模型.权重和对齐,那么本期我们来学习LinearLayout ...

随机推荐

  1. cloudstack安装篇1-linux命令修改IP信息

    方式一:   ifconfig eth0 192.168.1.18 netmask 255.255.255.0   说明:该种方式可以使改变即时生效,重启后会恢复为原来的IP   方式二:   vi ...

  2. PHP邮箱验证是否有效

    今天一开电脑发现有人在我的主页给我乱留言,所以加了一个邮箱验证. 网上发现一个很巧妙的算法,分享一下: function checkmail($email){ $exp = "^[a-z'0 ...

  3. java 小结1(static ,final,泛型)

    static,final. (1)final: final:属于“终态”,意思就是不可以改变.可以修饰非抽象类,非抽象类的方法等.反正就是不能够再改变赋值了. 注意:1)fina类不能被继承,所以它没 ...

  4. 终端ls显示的配色方案

    打开~/.profile或者mac上的~/.bash_profile,加入: export CLICOLOR=1 export LSCOLORS=cxdxfxexbxegedabagacad 这是我的 ...

  5. HW5.16

    public class Solution { public static void main(String[] args) { for(int i = 2000; i <= 2010; i++ ...

  6. Codeforces10D–LCIS(区间DP)

    题目大意 给定两个序列,要求你求出最长公共上升子序列 题解 LIS和LCS的合体,YY好久没YY出方程,看了网友的题解,主要是参考aikilis的,直接搬过来好了 经典的动态规划优化. 用opt[i] ...

  7. 如果iis的配置文件 applicationHost.config坏掉了, 会在 C:\inetpub\history\ 中存储历史备份。复制过去还原就可以了-摘自网络

    You will usually get the error ‘Configuration file is not well-formed XML’ ‘C:\Windows\system32\inet ...

  8. WeUI首页、文档和下载 - 专为微信设计的 UI 库 - 开源中国社区

    Download Bitnami Review Board Stack click here WeUI首页.文档和下载 - 专为微信设计的 UI 库 - 开源中国社区

  9. A Tour of Go If and else

    Variables declared inside an if short statement are also available inside any of the else blocks. pa ...

  10. light oj 1297 Largest Box

    1297 - Largest Box   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB In t ...