angular中,经常看到这些不像js的代码,以为是typescript的语法,其实是js的,es6(2015)就支持了。
比如:
import {firstName, lastName, year} from './profile';
export class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
toString() {
return '(' + this.x + ', ' + this.y + ')';
}
}
let a = 10;
const PI = 3.1415;
这个es6教程讲的很好 http://jsrun.net/tutorial/FZKKp