美文网首页工作生活
es6 Arry String Json 笔记

es6 Arry String Json 笔记

作者: 幸宇 | 来源:发表于2019-06-30 19:45 被阅读0次

arry 映射
map
forEach
filter
reduce

String
startsWith
endsWith

Json
1.标准写法
{"key":"aaa","key2":12}
2.JSON 对象
stringify() 转为字符串,给服务器
parse() //反转回来用

异步处理
异步操作
异步----多个操作可以一起进行,互不干扰
同步----操作一个个进行

Promise
    all
    async/await

兼容性
babel:
1.在线:
引入babel.js type="text/babel"

2.编译
node.js
npm @babel/core @babel/cil @babel/preset-env
添加脚本
build:babel src -d dest
添加 .babelrc-声明preset

es7:** Arraoy.includes()

es8:await/async

es9:rest/spread 异步迭代 Promis.finally() 正则

面向对象
机器语言 -> 汇编 -> 低级语言 -》高级语言 -》模块

闭包
es6模块化

webPack 来解决es6模块化不兼容的问题
npm i webpack -g
1. entry ---入口地址
2. output----输出
path:绝对路径
filename:文件名
3. mode-----模式
4.所有当前路径前加 ./

配置:webpack.config.js 
           module.exports = {
              mode:'production',
              entry:"index.js"  // 入口
              output:{
                  path:path.resolve(__dirname,'build'),
                  filename:'bundle.js'
              }  // 打包出去,必须是对象
            }

export
    export let a = XX;
    export let b = XX;
    export {a,b}
    export function XXX(){}
    export class XX{}
    exoprt default XX;

import

import * as mode from './'
import {a,b,c} from "./

引入默认成员
import s from "./
模块代码引入进来,不引入内部成员
import “./1.jpg”
import "./1.css"

异步引入
let promise = import ("./mod")

相关文章

网友评论

    本文标题:es6 Arry String Json 笔记

    本文链接:https://www.haomeiwen.com/subject/grzpcctx.html