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

浙公网安备 33010602011771号