Last active
April 29, 2017 20:25
-
-
Save andresaraujo/49be41335f72563964bb81ef9a39933b to your computer and use it in GitHub Desktop.
JS DCR/Tree shaking VS Dart2JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main() { | |
var dog = new Dog('Mitzie'); | |
dog.speak(); | |
} | |
class Animal { | |
var name; | |
Animal(this.name); | |
speak() => print('$name makes a noise.'); | |
} | |
class Dog extends Animal { | |
Dog(name) : super(name); | |
speak() => print('$name barks.'); | |
} | |
class Cat extends Animal { | |
Cat(name) : super(name); | |
speak() => print('$name meows.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal { | |
constructor(name) { | |
this.name = name; | |
} | |
speak() { | |
console.log(`${this.name} makes a noise.`); | |
} | |
} | |
class Dog extends Animal { | |
speak() { | |
console.log(`${this.name} barks.`); | |
} | |
} | |
class Cat extends Animal { | |
speak() { | |
console.log(`${this.name} meows.`); | |
} | |
} | |
var dog = new Dog('Mitzie'); | |
dog.speak(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 195 characters/bytes | |
class Animal{constructor(a){this.name=a}speak(){console.log(`${this.name} makes a noise.`)}}class Dog extends Animal{speak(){console.log(`${this.name} barks.`)}}var dog=new Dog('Mitzie');dog.speak(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 48 characters/bytes | |
main: function() { | |
P.print("Mitzie barks."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal { | |
constructor(name) { | |
this.name = name; | |
} | |
speak() { | |
console.log(`${this.name} makes a noise.`); | |
} | |
} | |
class Dog extends Animal { | |
speak() { | |
console.log(`${this.name} barks.`); | |
} | |
} | |
var dog = new Dog('Mitzie'); | |
dog.speak(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment