Blogger Information
Blog 6
fans 0
comment 0
visits 1383
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
js 学习1
小羊bug库
Original
189 people have browsed it

函数

  • 命名函数: function
    先声明在调用
    function xxx(a,b){ } return xxx

  • 匿名函数: fn = function (){}
    不存在声明提升,可以将一个匿名函数赋值给一个let/const声明的变量
    let/const不存在声明提升,所以它所引用的函数也不会声明提升
    函数表达式(函数变量): 值是一个匿名函数
    ` const sum1 = function (a, b) {

    1. return `${a} + ${b} = ${a + b}`
    2. }
    3. console.log(sum1(5, 6))`
  • 箭头函数: fn = ()=>{}
    声明简化
    1. * 1. 删除: function
    2. * 2. (){}: ()=>{}
    3. * (参数列表)与{代码块}之间用胖箭头=>连接
    参数简化
    1. * 1. 单参数: 可不加括号 ()
    2. * 2. 多个参数或无参数: 必须加括号 ()
  • 立即执行函数: (function(){})()
    1. 声明与调用二合一(声明时立即调用): IIFE
    2. 写完就执行完了,所以是一次性的,肯定是匿名函数

数据类型

  • 原始类型: string,number,boolean,null,undefined
  • 引用类型: array,object,function
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post