true

typeof与instanceof比较+undefined与null各种值的相互比较

南楼画角 提交于 2019-11-29 19:53:30
1、typeof:返回一个字符串 根据typeof判断对象 表达式 返回值 typeof undefined 'undefined' typeof true 'boolean' typeof 123 'number' typeof "abc" 'string' typeof function() {} 'function' typeof {} 'object' typeof [] 'object' typeof null 'object' function f(...args) { console.log(typeof args); //object   console.log(args instanceof Array); //true} 总结:typeof返回值是一个字符串,该字符串说明运算数的类型,一般只返回一下六种: number、string、Boolean、undefined、function、object(null、对象、数组) 对于数组、对象以及null,返回值都为object,这正是typeof的局限性。 2、instanceof:用于判断一个变量是否为某个类的实例 var a = []; console.log(a instanceof Array); //true console.log(a instanceof Object); //true

Integer比较

邮差的信 提交于 2019-11-29 19:43:51
这个Integer比较真的是坑啊.......... 先看代码,大家来猜猜,看看到底会输出什么: 1 public class Test1 { 2 3 public static void main(String[] args) { 4 Integer a = 128; 5 Integer b = 128; 6 int c = 128; 7 System.out.println(a==b);//false 8 System.out.println(b==c);//true 9 System.out.println(c==b);//true 10 11 System.out.println("========="); 12 Integer a1 = 10; 13 Integer b1 = 10; 14 int c1 = 10; 15 System.out.println(a1==b1); 16 System.out.println(b1==c1); 17 System.out.println(c1==b1); 18 System.out.println("========="); 19 20 int a11 = 10; 21 Integer b11 = new Integer(10); 22 System.out.println(a11== b11); //Line 1 23 24

js中不同类型作比较

一曲冷凌霜 提交于 2019-11-29 09:51:52
示例: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> </body> <script> // 0 和 '' 和 [] 和 false 四者任意比较(==)都为true if(0 == '') { console.log("1") } if(0 == []) { console.log("2") } if(0 == false) { console.log("3") } // 0 和 '' 和 [] 和 false 四者 与 {}比较(==)都为false if(0 == {}) { console.log("4") } //null 和 undefined比较(==)为true,和其他比较都为false if(null == undefined) { console.log("5") } // 0 和 '' 和 false 和 null 和 undefined 转换为布尔值默认都为false if(0 || "" || false || null || undefined){ console.log("6") } /

AndroidManifest.xml配置文件详解

痴心易碎 提交于 2019-11-29 06:53:58
AndroidManifest.xml配置文件对于Android应用开发来说是非常重要的基础知识,本文旨在总结该配置文件中重点的用法,以便日后查阅。下面是一个标准的AndroidManifest.xml文件样例。 [html] view plain copy <? xml version = "1.0" encoding = "utf-8" ?> < manifest > <!-- 基本配置 --> < uses-permission /> < permission /> < permission-tree /> < permission-group /> < instrumentation /> < uses-sdk /> < uses-configuration /> < uses-feature /> < supports-screens /> < compatible-screens /> < supports-gl-texture /> <!-- 应用配置 --> < application > <!-- Activity 配置 --> < activity > < intent-filter > < action /> < category /> < data /> </ intent-filter > < meta-data /> </ activity > <

Mybatis学习日志二

▼魔方 西西 提交于 2019-11-29 00:49:56
一、动态sql   1、动态SQL:if 语句    <select id="selectUserByUsernameAndSex" resultType="user" parameterType="com.ys.po.User"> select * from user where <if test="username != null"> username=#{username} </if> <if test="username != null"> and sex=#{sex} </if> </select>   2、动态SQL:if+where 语句 <select id="selectUserByUsernameAndSex" resultType="user" parameterType="com.ys.po.User"> select * from user <where> <if test="username != null"> username=#{username} </if> <if test="username != null"> and sex=#{sex} </if> </where> </select>   3、动态SQL:if+set 语句 <!-- 根据 id 更新 user 表的数据 --> <update id="updateUserById"

05字符串运用

五迷三道 提交于 2019-11-28 10:03:47
课后作业1:字串加密 古罗马皇帝凯撒在打仗时曾经使用过以下方法加密军事情报: 请编写一个程序,使用上述算法加密或解密用户输入的英文字串要求设计思想、程序流程图、源代码、结果截图。 设计思想: 输入字符串->将字符串转换为单个字符->每个字符加3->连接字符串->字符串加密输出 程序流程图: 源代码: //陶雨洁 2016/10/28 20153152 package 字符运用; import javax.swing.*; import java.util.Scanner; public class Stringyy { public static void main( String args[] ) { //转为可用字符串 System.out.println("输入加密的字母字符"); Scanner input=new Scanner(System.in); String mm=input.nextLine(); int n=mm.length(); String str1=new String(); for(int i=0;i<n;i++) { char a=mm.charAt(i);//取出单个字符 a=(char)(a+3);//每个字符对应加3得到对应的字符 str1=str1+a;//连接 } System.out.println("加密后的为:"+str1); }

numpy中位操作函数和比较函数

[亡魂溺海] 提交于 2019-11-28 08:59:42
位操作函数和比较函数 位操作函数可以在整数或整数数组的位上进行操作 Key_Function xor操作符, 当两个操作数的符号不一致时, 结果为负数 位操作符: ^ 对应bitwise_xor函数, 当两个元素的正负号不一致时, 返回是负数的那个数字 & 对二进制字节进行AND操作, 只有都是1的时候才返回1 | << 位的左移, 数值翻倍 >> 位的右移, 数值减半 比较运算符: < 对应less函数, 这个就是小于符号 > 大于符号 == 等于符号 Code import numpy as np x = np.arange(-9, 9) y = -x print((x ^ y) < 0) ''' [ True True True True True True True True True False True True True True True True True True] ''' print(np.less(np.bitwise_xor(x, y), 0)) ''' [ True True True True True True True True True False True True True True True True True True] ''' print((x & (x - 1)) == 0) # & 为并运算, 0 1 取 1 # 在二进制数中,

正则表达式

和自甴很熟 提交于 2019-11-28 04:02:54
1.正则表达式的概述和简单使用   是指用来描述或匹配字符串是否符合自己的语法规则,其实就是一种规则,有自己特殊用途   比如注册账号时,会限制用户名和密码的长度,这个限制长度就是正则表达式做的   1 /** 2 * B:案例演示 3 * 需求:校验qq号码. 4 * 1:要求必须是5-15位数字 5 * 2:0不能开头 6 * 3:必须都是数字 7 */ 8 9 demo1(); 10 // 正则表达式的匹配规则,用正则表达式实现 11 String regex = "[1-9]\\d{4,14}"; 12 13 System.out.println("0123456".matches(regex)); //false 14 System.out.println("a1234567".matches(regex)); //false 15 System.out.println("930275779".matches(regex)); //true 16 System.out.println(Pattern.matches(regex, "1234567"));//true 17 } 18 19 20 // 用已循环和if语句实现 21 public static void demo1() { 22 System.out.println(checkQQ("012345")); /

JavaScript中为什么需要!!?

梦想的初衷 提交于 2019-11-28 00:56:07
1. 布尔值为false的值 在JavaScript中,布尔值为 false 的值有如下几个: undefined null false 0 NaN "" 或 '' (空字符串) 2. !!的作用 将上述值与 false 作比较。 console.log(undefined==false); // false console.log(null==false); // false console.log(false==false); // true console.log(0==false); // true console.log(NaN==false); // false console.log(""==false); // true console.log(''==false); // true 发现 undefined==false 、 null==false 和 NaN==false 的值均为 false ,如果加上 !! ,结果如下: console.log(!!undefined==false); // true console.log(!!null==false); // true console.log(!!false==false); // true console.log(!!0==false); // true console.log(!!NaN==false

tomcat 配置更改 web 目录

六眼飞鱼酱① 提交于 2019-11-28 00:52:44
tomcat 虚拟目录:( 编辑 tomcat/conf/server.xml ) <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context docBase="/opt/server/tomcat/webapps/app-test" path="" reloadable="true" crossContext="true"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host> 添加 Context 启动有个异常,配置指定目录之后不能正常启动;可以切换到 tomcat 的环境变量中再进行启动服务。 来源: https://www.cnblogs.com/sharesdk/p/11384155.html