上一页 1 ··· 6 7 8 9 10
摘要: var ni={ name:'zs', age:18 } //遍历对象 for(var i in ni) { console.log(i);//返回name字符串 因为 var i='name'; console.log(ni[i]);//返回name=的值 console.log() } //判断 阅读全文
posted @ 2019-10-12 21:06 handsomehe 阅读(1543) 评论(0) 推荐(0) 编辑
摘要: 1. 把var声明的变量提升到当前作用域最前面,不会提升赋值 console.log(num); var num=10; //相当于 var num; console.log(num); num=10; //得不到10的结果; 2. 把函数声明 提升到当前作用域的最前面 test(); functi 阅读全文
posted @ 2019-10-11 17:31 handsomehe 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 1,函数作为参数 通常把函数作为参数叫做回调函数 function fn1(fn) { fn(); } fn1(function(){ console.log("哈哈"); }); 2,函数作为返回值 function fn1() { return function(){ console.log(" 阅读全文
posted @ 2019-10-11 16:33 handsomehe 阅读(2011) 评论(0) 推荐(0) 编辑
摘要: 字符串转换成数值类型(在字符串前加上+号可以将后面的字符串转换成整数,减去0也可) var num4=+'123' console.log(num4); console.log(typeof num4); var num5='123'-0; console.log(num5); console.lo 阅读全文
posted @ 2019-10-10 00:44 handsomehe 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 引号可以嵌套,但是只能相互嵌套,单引号可以嵌套双引号,双引号可以嵌套单引号,单不能嵌套单,双不能嵌套双,要想单引号嵌套单要用转义字符;(加上\就是把后面跟的显示出来如\" \" 显示出"") <script> var num="我姓'薰',我叫孙悟空"; console.log(num); var 阅读全文
posted @ 2019-10-09 17:01 handsomehe 阅读(819) 评论(0) 推荐(0) 编辑
摘要: 字符类函数1,ascii(c)函数和chr(i)函数ascii(c)函数用于返回一个字符的ascii码,其参数c表示一个字符;chr(i)函数用于返回ascii码值对应的字符。 2,concat(s1,s2)函数该函数将字符串s2连接到字符串s1的后面,如果s1为null,则返回s2;如果s2为nu 阅读全文
posted @ 2019-10-08 13:03 handsomehe 阅读(818) 评论(0) 推荐(0) 编辑
摘要: 脱标定位元素是内容有多大撑多大 (但是宽度不会超出他的相对的那个元素 可以理解为父级元素) <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .box { wi 阅读全文
posted @ 2019-10-07 19:16 handsomehe 阅读(446) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10