摘要: 1、window.location当前页面地址信息 属性: href url完整地址 hash 路由,#开始的部分 search 查询部分,?开始的url host 主机名及端口号 hostname 主机名 pathname url路径部分 方法: replace() 替换 reload() 重新加 阅读全文
posted @ 2018-12-27 15:22 alisa.huang 阅读(547) 评论(0) 推荐(0) 编辑
摘要: 1、区别 浅拷贝:只拷贝了基本数据类型,引用数据类型只复制了引用,没有复制实体。 深拷贝:拷贝所有的层级属性 2、浅拷贝 (1) 直接赋值 拷贝之后,所有层级属性仍然公用了地址,会被影响 var a = [0, 1, [2,3], 4], b = a; a[0] = 1; a[2][0] = 1; 阅读全文
posted @ 2018-12-27 15:14 alisa.huang 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 一、函数调用的4种模式 1、函数调用 function foo() { alert('hello'); } foo();注意:this 专指全局对象 window 2、方法调用 // 定义一个函数 var foo = function() { alert("我是一个函数么?"); }; // 将其赋 阅读全文
posted @ 2018-12-27 15:01 alisa.huang 阅读(12299) 评论(0) 推荐(0) 编辑
摘要: 一、遍历数组的几种方式 var arr = [1,2,3]; Array.prototype.test=function(){} arr.name='jq' 1、 for /* * index是number类型的,可以使用break,continue,return语句 * 可以遍历对象 */ for 阅读全文
posted @ 2018-12-27 14:45 alisa.huang 阅读(262) 评论(0) 推荐(0) 编辑