欢迎光临,流星雨博客!!!
  • 33 arr.push() 添加元素

    将参数添加到原数组末尾,并返回数组的长度

  • 34 arr.unshift() 添加数组元素

    将参数添加到原数组开头,并返回数组的长度

  • 36 if 判断语句

    if(){

    }else if(){

    }else{

    }

  • 37 for 循环语句

    for(var i = 0; i< 10; i++){
    if(i==10) {
    break; 中止循环
    }
    if(i==5) {
    continue; 跳出本次循环
    }
    }

  • 38 document.getElementById 获取对象

    document.getElementById("demo")

  • 39 console.log(); 写到控制台

    console.log('hello word');

  • 40 while 循环语句

    while (条件)
    {
    需要执行的代码
    }

  • 41 do while 循环语句

    do
    {
    x=x + "The number is " + i + "
    ";
    i++;
    }
    while (i<5);

  • 42 onchange HTML 元素改变

  • 43 onclick 用户点击 HTML 元素

  • 44 onmouseover 用户在一个HTML元素上移动鼠标

  • 45 onmouseout 用户从一个HTML元素上移开鼠标

  • 46 onkeydown 用户按下键盘按键

  • 47 onload 浏览器已完成页面的加载

  • 48 setInterval 计时器

    setInterval(function(){alert("Hello")},3000);

  • 49 setTimeout() 延迟器

  • 50 clearTimeout 停止计时器

  • 83 .play() 开始播放视频(音频)

  • 84 .pause() 暂停播放视频(音频)

  • 95 getElementByTagName 获取标签对象

    document.getElementByTagName("div")

  • 96 getElementByClassName 获取class对象

    document.getElementByClassName("header")

  • 97 getAttrbute 获取标签的属性值

    obj.getAttrbute("title")

  • 98 setAttrbute 修改标签属性的值

    obj.setAttrbute("title","流星雨")

  • 99 childNodes 获取元素的子节点集合

    element.childNodes

  • 100 nodeType 节点类型

    document.body.nodeType

  • 101 nodeValue 节点值

    childNodes[0].nodeValue

  • 102 firstChild 获取节点集合中的第一个值

    childNodes[0].nodeValue == childNodes.firstChild.nodeValue

  • 103 lastChild 获取节点集合中最后一个

    node.lastChild

  • 179 ...arr 展开运算符

  • 180 let 定义变量

  • 181 const 定义常量

  • 182 解构赋值 快速提取值赋给变量

    let foo = ["a","b","c"]

    let [a,b] = foo; // a = "a" ; b = "b"

  • 183 class

    class A{
    constructor(name,age){
    this.name = name;
    this.age = age
    }
    }

    //
    class B extends A{
    constructor(){
    // 子类必须在constructor 中指定super 函数
    // 如果没有置顶constructor 默认带super的函数的constructor 将会被添加
    super("lxy",25)
    }
    }

  • 184 export 导出

    export const a = "123"


    export default {

    }

  • 185 import 导入

    import A from "a" // a.js

  • 186 () => {} 剪头函数

  • 187 `` 模板字符串

    let c = "c"

    let b = `ab ${a}` // abc

  • 188 对象简写

    const a = "a"
    const b = "b"

    const c = {
    a:a
    b:b
    }

    // 简写

    const c = {
    a,
    b
    }

  • 189 Promise 一般用于处理异步请求

    let req = new Promise((resolve,reject)=>{
    setTimeout(resolve,1000)
    })

    req.then(res => {
    console.log(res)
    })

  • 190 includes 判断值是否在该数组中

    if(arr.includes(x)){

    }

  • 191 async/await 异步函数

    async login(){
    const user = await get_user();
    }

    this.login();

  • 192 Object.values()

    const obj = {a:1,b:2,c:3}

    console.log(Object.values(obj1)); // [1,2,3]

  • 193 Object.entries()

    for (let [key,value] of Object.entires(obj)){
    console.log(`key:${key},value:${value}`)
    }

  • 206 filter() 过滤