2 ms·
name: string; constructor(name: string) { this.name = name } You don't have to do this in TypeScript either, you can just do constructor(p
by realharo 9y ago
name: string;
constructor(name: string) {
this.name = name
}
You don't have to do this in TypeScript either, you can just do
constructor(public name: string) { }
Also, the "Empty collections" section doesn't do the same thing, the collections you created in Kotlin are immutable.
And the TypeScript ones have the value `undefined` (unfortunate that strictNullChecks doesn't catch things like that https://github.com/Microsoft/TypeScript/issues/8476 https://github.com/Microsoft/TypeScript/issues/8476).
And for some nitpicking, please be consistent with your semicolons, either use them or don't use them, but don't mix it randomly like that.
- Cthulhu_ 9y agoSome of the TS examples also include an external library (lodash) to compare features; not sure if that's an apt comparison.