binperson / blog

personal blog 😍
Apache License 2.0
0 stars 0 forks source link

ES6模块 #5

Open binperson opened 7 years ago

binperson commented 7 years ago

参考:ECMAScript 6 入门

export 命令

// profile.js
export var firstName = 'Michael';
export var lastName = 'Jackson';
export var year = 1958;

// profile.js
export var firstName = 'Michael';
export var lastName = 'Jackson';
export var year = 1958;

// profile.js
var firstName = 'Michael';
var lastName = 'Jackson';
var year = 1958;

export {firstName, lastName, year};

export function multiply(x, y) {
  return x * y;
};