Javascript Basic Operation Extraction
1. logic operation : '&&' and '||' .For this two logic operations,its' results are inconclusive.the difference between this two logic operations and others is that they don't change the data type of the operands and also don't change the data type of the operation result. In the expression , this operator(&& and ||) will understand the type of the operands as the bool type ,so they can execute bool operation.you can have a look below.
<html>
<head>
<meta http-equiv="content-type" charset="utf-8"/>
<script type="text/javascript">
var str = "hello";
var obj = {};
alert(str || obj);//str as string type ,obj as an object,return str("hello")
alert(str && obj);//return obj
alert(undefined || 123);//undefined as false,and return 123
</script>
</head>
<body>
</body>
</html>
2. comparison operation. For comparing two value type data,generally just compare their values.For comparing a value type data and a reference type data,first switch the reference type data to the same type as the value type data,then compare them.For comparing two reference type data,it's unmeaning and always return false.like below:
<html>
<head>
<meta http-equiv="content-type" charset="utf-8"/>
<script type="text/javascript">
var o1 = {};
var o2 = {};
var str = "123";
var num = 1;
var b0 = false;
var b1 = true;
var ref = new String(); alert(b1 < num);//return false;
alert(b1 <= num);//return true;
alert(b1 > b0);//return true; alert(num > ref);//return true; alert(o1 > o1 || o1 < o2 || o1 == o2);//always return false;
</script>
</head>
<body>
</body>
</html>
Javascript Basic Operation Extraction的更多相关文章
- matlab basic operation command
Matlab basic operation: >> 5+6 ans = 11 >> 3*4 ans = 12 >> 2^6 ans = 64 >> 1 ...
- 【MongoDB】The basic operation of Index in MongoDB
In the past four blogs, we attached importance to the index, including description and comparison wi ...
- JavaScript Basic
Exercise-1 Write a JavaScript program to display the current day and time in the following format. T ...
- Basic Operation about Linux
1. 永久开启/关闭防火墙 在linux中防火墙是一个名叫iptables的工具 开启: chkconfig iptables on 关闭: chkconfig iptables off 即时生效,重 ...
- mysql basic operation,mysql总结
mysql> select * from wifi_data where dev_id like "0023-AABBCCCCBBAA" ; 1.显示数据库列表.show d ...
- HDFS Basic Operation
1.如何启动一个命令行的hadoop客户端 任何一个Hadoop集群中的节点,只要有hadoop安装包,就可以通过# hadoop fs来启动 2.Hadoop基本命令格式 # hadoop fs ...
- JavaScript Basic Memo
1.this 的指向 1).由 new 调用?绑定到新创建的对象. 2). 由 call 或者 apply(或者 bind)调用?绑定到指定的对象. 3). 由上下文对象调用?绑定到那个上下文对象. ...
- Chapter 2 JavaScript Basic
Has 5 primitive types: Undefined, Null, Boolean, String, Number. typeof operator Undefined return u ...
- mysql basic operation,mysql总结,对mysql经常使用语句的详细总结,MySQL学习笔记
mysql> select * from wifi_data where dev_id like "0023-AABBCCCCBBAA" ; 1.显示数据库列表.show d ...
随机推荐
- (转)linux 技巧:使用 screen 管理你的远程会话
转自:http://www.ibm.com/developerworks/cn/linux/l-cn-screen/index.html 你是不是经常需要 SSH 或者 telent 远程登录到 Li ...
- JSON 之JAVA 解析
一. JSON (JavaScript Object Notation)一种简单的数据格式,比xml更轻巧. Json建构于两种结构: 1.“名称/值”对的集合(A collection ...
- poj 2151 Check the difficulty of problems(概率dp)
poj double 就得交c++,我交G++错了一次 题目:http://poj.org/problem?id=2151 题意:ACM比赛中,共M道题,T个队,pij表示第i队解出第j题的概率 问 ...
- Sencha touch navigation 内嵌list,itemTap第二次点击不跳转的问题
情景:navigation view 内嵌list,第一次触发list事件itemtap,正常跳转至详情页,点击"defaultBackButton"返回至list正常;再次点击触 ...
- JQuery设置与获取RadioButtonList和CheckBoxList的值
有这样一个问题,要获取ASP.NET控件RadioButtonList的值,首先想到的就是$("#<%=RadioButtonList1.ClientID %>").v ...
- 关于 tomcat 集群中 session 共享的三种方法
前两种均需要使用 memcached 或redis 存储 session ,最后一种使用 terracotta 服务器共享. 建议使用 redis,不仅仅因为它可以将缓存的内容持久化,还因为它支持的单 ...
- UVA 1349 Optimal Bus Route Design 最优公交路线(最小费用流,拆点)
题意: 给若干景点,每个景点有若干单向边到达其他景点,要求规划一下公交路线,使得每个景点有车可达,并且每个景点只能有1车经过1次,公车必须走环形回到出发点(出发点走2次).问是否存在这样的线路?若存在 ...
- angular bootstrap
2个js冲突,点击2次才显示,去掉data-toggle="dropdown"
- 阿里云至 Windows Azure 的 Linux 虚拟机迁移
在Windows Azure中,用户可以对部署在Azure中的虚拟机的映像.磁盘以及快照进行生成和下载.用户可以方便地将Azure中的虚拟机实例迁移到本地.私有云甚至其他公有云平台进行测试.扩展或者再 ...
- 【转】NDK上建立自己的项目
原文网址:http://www.cnblogs.com/sardine/archive/2011/07/30/2121845.html 建立Android.mk文件 ~/android-ndk/app ...