摘要:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style>*{margin:0; padding: 0;list-style:none;}div{ height: 514px
阅读全文
posted @ 2017-07-25 17:11
YC小杨
阅读(245)
推荐(0)
摘要:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style> *{ margin:0; padding: 0; } .all{ height: 514px; width: 40
阅读全文
posted @ 2017-07-24 21:32
YC小杨
阅读(156)
推荐(0)
摘要:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style> *{ margin:0; padding: 0; list-style-type: none; } ul.img{
阅读全文
posted @ 2017-07-24 21:31
YC小杨
阅读(130)
推荐(0)
摘要:
document . querySelector( "选择器" ) 找到对应的元素(节点),只找一个,如果有多个就只找第一个。 document . querySelectorAll( "选择器" ) 找到对应的所有元素(节点) document . querySelector( "选择器" ) .
阅读全文
posted @ 2017-07-20 19:33
YC小杨
阅读(120)
推荐(0)
摘要:
function fn(name) { var jc = ["敏感字符", "广电总局"]; var gc = ["*****", "****"]; if(typeof(name) "string") { for(var j = 0; j < jc.length; j++) { for(var i
阅读全文
posted @ 2017-07-20 12:47
YC小杨
阅读(1627)
推荐(0)
摘要:
function fn(n) { return 380 + 100 * Math.sin(n * ((2 * Math.PI) / 7)) - 20; }; function fm(m) { return 380 - 100 * Math.cos(m * ((2 * Math.PI) / 7)) -
阅读全文
posted @ 2017-07-20 12:43
YC小杨
阅读(142)
推荐(0)
摘要:
//把一个数组传入函数内,返回一个新的数组,这个数组保存的是第一个数组中每一个元素重复的次数。 function fa ( arr ) { var num; var arra = [ ]; for ( var i = 0; i < arr.length; i++ ) { num = 0; for (
阅读全文
posted @ 2017-07-18 22:30
YC小杨
阅读(312)
推荐(0)
摘要:
Class(类) Js中,生成实例对象的传统方法是通过构造函数 function Point(x, y) { this.x = x; this.y = y; } var p = new Point(1, 2); 上面这种写法跟传统的面向对象语言(比如 C++ 和 Java)差异很大 ES6 提供了更
阅读全文
posted @ 2017-07-17 22:28
YC小杨
阅读(135)
推荐(0)
摘要:
forEach()和map()遍历 共同点: 1.都是循环遍历数组中的每一项。 2.forEach() 和 map() 里面每一次执行匿名函数都支持3个参数:数组中的当前项item,当前项的索引index,原始数组input。 3.匿名函数中的this都是指Window。 4.只能遍历数组。 1.f
阅读全文
posted @ 2017-07-14 16:56
YC小杨
阅读(280)
推荐(0)
摘要:
箭头函数(重点) ES6 允许使用“箭头”(=>)定义函数。 var f = v => v; f(20)//20 等同于: var f = function(v) { return v; }; f(20)//20 如果箭头函数不需要参数或需要多个参数,就使用一个圆括号代表参数部分。 var f =
阅读全文
posted @ 2017-07-14 16:41
YC小杨
阅读(283)
推荐(0)