1 Index.html
2 cal.js
/** * Created by Jackey Li on 2015/7/26. */import {Hello} from './profile.js';class Calc { constructor(){ this.hello = new Hello(); this.hello.sayHi(); console.log('Calc constructor'); } add(a, b){ return a + b; }}var c = new Calc();console.log(c.add(4,5));
3 profile.js
/** * Created by Jackey Li on 2015/7/26. */export class Hello{ constructor(){ } sayHi(){ console.log('hi'); }}