企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
const 变量不变 let 变量可变 箭头函数,支持默认设置参数 ~~~ const fn=(a=1,b=2)=>{return a+b;} const fn1 = (a,b)=>a+b; //简写,当返回值可省略括号 ~~~ 字符模板,不再使用+链接字符串 ~~~ const a = 20; const b = 30; const string = `${a}+${b}=${a+b}`; ~~~ 解析结构 ~~~ const obj={ a:1, b:2, c:3 } const {a,b}=obj; 对象解析结构 let [a, b, c] = [1, 2, 3];数组的解析结构 let [a, ...b] = [1, 2, 3]; 剩余运算 a=1 b=[2,3] ~~~ 简写,当属性和值相同 ~~~ const person = { name, age,fn(){ return this.name; } }等价 var person = { name: name, age: age , fn:function fn(){ return this.name; } }; ~~~ 类 ``` class Person { //构造方法 constructor(name, age) { this.name = name; this.age = age; } getName() { return this.name } } ``` 模块 接口定义可以是变量,函数,类 var m=1 export {m} export default默认方法或变量 import {m} from 'm';