文章分类 -  html js css

摘要:// let promise1 = new Promise((resovle, reject) => { // resovle('wwww') // }) // promise1().then((aa) => { // console.log(aa) // }) //异步函数 在普通函数定义前面加a 阅读全文
posted @ 2020-05-14 16:34 howhy 阅读(363) 评论(0) 推荐(0)
摘要:在项目目录下建gulpfile.js 然后创建src dist目录 gulpfile.js文件代码 const gulp = require('gulp') const htmlmin = require('gulp-htmlmin') //压缩html const babel = require( 阅读全文
posted @ 2020-05-13 10:57 howhy 阅读(842) 评论(0) 推荐(0)
摘要:const sum = (a, b) => a + b //函数体只有一句 并且返回值就是该句函数体的结果 可以省略大括号和return console.log(sum(3, 4)) //7 const con = a => console.log(a) //参数只有一个可以省略小括号 con('1 阅读全文
posted @ 2020-05-12 11:04 howhy 阅读(440) 评论(0) 推荐(0)
摘要://解构赋值 let num = [1, 3, 4] let [a, _, b] = num console.log(a, b) //1,4 let [c,...d] = num console.log(c)//1 console.log(d)//[3,4] let obj = { name: 'u 阅读全文
posted @ 2020-05-12 10:40 howhy 阅读(90) 评论(0) 推荐(0)
摘要:let 不存在变量提升 console.log(c) //undefined 预解析会变量C会提升 console.log(d) //报错必先声明再使用 var c = 30; let d = 30; let 会有块级作用域 for (let i = 0; i < 10; i++) { } cons 阅读全文
posted @ 2020-05-12 10:17 howhy 阅读(54) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2020-05-11 14:03 howhy 阅读(137) 评论(0) 推荐(0)
摘要://自执行函数 (function() { console.log(33333333) })() //改变函数this指向方法call bind apply call和apply不同在于传的参数不一样 apply参数是数组 bind不会执行函数,但会返回一个新的函数 var obj = { name 阅读全文
posted @ 2020-05-11 13:52 howhy 阅读(702) 评论(0) 推荐(0)
摘要://es5数组新方法 在forEach filter里用return true 没用的会一直循环 但在some里return true只要满足条件了就中止循环 var nums = [1, 3, 14, 5, 2, 15, 11] nums.forEach((value, index, arr) = 阅读全文
posted @ 2020-05-11 11:16 howhy 阅读(242) 评论(0) 推荐(0)
摘要://构造函数创建对象 构造函数默认有一个原型prototype对象(用于共享实例对象共有方法),实例对象也有一个原型对象__proto__指向了构造函数的原型对象prototype function Star(name) { this.name = name; //若将共有方法定义在构造函数里则ne 阅读全文
posted @ 2020-05-08 17:53 howhy 阅读(217) 评论(0) 推荐(0)
摘要://ES6之前没有class类的定义都是通过构造函数 call实现类的继承 function Animal(name, age) { this.name = name; this.age = age } Animal.prototype.eat = function() { console.log( 阅读全文
posted @ 2020-05-08 16:06 howhy 阅读(237) 评论(0) 推荐(0)
摘要:<script> //数组反转 function arrayReverse(arr) { if (Array.isArray(arr)) { var newArr = [] for (var i = arr.length - 1; i >= 0; i--) { newArr.push(arr[i]) 阅读全文
posted @ 2020-05-08 14:18 howhy 阅读(123) 评论(0) 推荐(0)
摘要:function getTime() { var endDate = new Date("2020-05-09 11:00:00").getTime() var startDate = new Date().getTime() var seconds = (endDate - startDate) 阅读全文
posted @ 2020-05-08 09:55 howhy 阅读(48) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2020-05-07 18:06 howhy 阅读(91) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2020-05-07 16:45 howhy 阅读(78) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2020-05-07 15:10 howhy 阅读(84) 评论(0) 推荐(0)
摘要:1、module.exports module变量代表当前模块。这个变量是一个对象,module对象会创建一个叫exports的属性,这个属性的默认值是一个空的对象: module.exports = {}; 例子:app.js module.exports.Name="我是电脑"; module. 阅读全文
posted @ 2020-04-22 15:26 howhy 阅读(178) 评论(0) 推荐(0)
摘要:position static默认的标准流 relative相对于自己原来的位置定位 还会占用原来的位置 absolute若父(最近爷往上)元素有定位则以父元素为准 若所有的父级都没有定位则以html为准 不会占用位置 fixed 不占用位置 以浏览器可视窗口为准 阅读全文
posted @ 2020-04-10 17:00 howhy 阅读(41) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2020-04-10 14:16 howhy 阅读(42) 评论(0) 推荐(0)
摘要:cursor :pointer visibility:hidden ##会占用元素位置 display:none ##不会占用位置 overflow:超出元素部分隐藏 overflow-x:auto overflow-y: outline:none 文本框蓝色的边vertical-align :ba 阅读全文
posted @ 2020-04-10 10:05 howhy 阅读(88) 评论(0) 推荐(0)
摘要:先定义@keyframes move{} 再使用 animation-name:move;animation-duration: 5s; 简写:animation: name duration timing-function delay iteration-count direction fill- 阅读全文
posted @ 2020-04-09 10:48 howhy 阅读(62) 评论(0) 推荐(0)