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 ...
随机推荐
- windows命令行编码与nodejs编码格式冲突的解决方式
今天写一个工具,由于大部分人使用的机器都是windows,在和nodejs结合的时候出问题了. win命令行的编码格式是gbk,而nodejs支持的编码只有:utf8 ascii和base64,必须让 ...
- CentOS7.1 Xshell 经常掉线 Connection closed by foreign host
XShell如果经常对CentOS掉线,则VNC肯定连接不上 但是ping CentOS的IP又能ping通,主要原因还是因为sshd的设置问题 #进入ssh目录 cd /etc/ssh #修改ssh ...
- C#如何使用和开发自定义配置节
在日常的程序设计中,如何灵活和巧妙地运用配置信息是一个成功的设计师的首要选择.这不仅是为了程序设计得更灵活性和可扩展性,也是为了让你的代码给人以清新的感觉.程序中的配置信息一般放在应用程序的app.c ...
- 【POJ】2104 K-th Number
区间第K大数.主席树可解. /* 2104 */ #include <iostream> #include <sstream> #include <string> ...
- Innodb parent table open时导致crash
case描述: innodb中,父表和子表通过foreign constraint进行关联, 因为在更新数据时需要check 外键constraint,如果父表被大量的子表reference, 那么在 ...
- Andriod x86 4,4
用 vbox 装了下Andriod x86 4,4 ,能用的App真心少,反正我只是用来看看安卓浏览器里网站效果,海豚浏览器还有qq浏览器x86版,还能用用,主要要换UA为iphone和ipad之类的 ...
- bzoj3170
以前写的,好像忘写解题报告 注意是一个跟曼哈顿距离很有用的结论 |xi-xj|+|yi-yj|=max(|xi+yi-(xj+yj)|,|xi-yi+(xj-yj)|) 因为绝对值有个性质是|a-b| ...
- [Mac][phpMyAdmin] [2002] No such file or directory
我从phpMyAdmin的官网下载了最新版,将它解压到 /Library/WebServer/Documents 下,然后把文件夹改名 phpmyadmin . 接着输入在浏览器中输入 localho ...
- 【Grunt】
GRUNT The JavaScript Task Runnerhttp://gruntjs.com/ Grunt打造前端自动化工作流http://tgideas.qq.com/webplat/inf ...
- windows远程桌面3389超时锁定时间调整方法(取消锁屏时间限制)
我们在管理服务器操作时,有时候需要长时间操作服务器,有时候稍微离开下倒杯水或接个稍长点的电话,就超时断开了很烦啦!有没有方法解决这个问题类?答案是有的!我只要在组策略里面,稍微修改下超时时间就可以了. ...