首页 > 其他 > 详细

ES6的相关新属性

时间:2016-08-01 20:57:58      阅读:239      评论:0      收藏:0      [点我收藏+]

1、class……extends

  es6中的class与es5 中的function差不多;

class Student extends People , student  继承了people父类;

 

 

2、let与var的区别

let声明块级变量,不知道下文变量的设置。

3、es6中的module导入与导出

import……from…… 导入模块

export * from ‘src/other_module‘;
export { foo, bar } from ‘src/other_module‘;
export { foo as myFoo, bar } from ‘src/other_module‘;

exports  导出函数

   更  es5  命名函数是一样的  在function嵌添加 exports  不需要再下面用onclick调用,可以直接引用即可

    export const sqrt = Math.sqrt;
    export function square(x) {
       return x * x;
     }
    export function diag(x, y) {
       return sqrt(square(x) + square(y));
    }

 

4、

 

ES6的相关新属性

原文:http://www.cnblogs.com/leyan/p/5727008.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!