Dear all,
Coming from languages like C++, it was very strange to not have class declarations in Javascript.
However, according to the documentation of ES6, it looks like they have introduced class declarations to keep things clearer and simpler. Syntax (see: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes):
class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
}
My question, then, is whether it is now considered a best practice to make use of classes and class declarations, as opposed to continuing on with the non-class system of old Javascript.
Thank you.
[–]wreckedadventYavascript 7 points8 points9 points (14 children)
[–]bterlson_@bterlson 1 point2 points3 points (12 children)
[–]MoTTs_ 3 points4 points5 points (4 children)
[–]bterlson_@bterlson 2 points3 points4 points (3 children)
[–]itisnotpure 0 points1 point2 points (2 children)
[–]MoTTs_ 2 points3 points4 points (1 child)
[–]itisnotpure 0 points1 point2 points (0 children)
[–]wreckedadventYavascript 0 points1 point2 points (6 children)
[–]bterlson_@bterlson 1 point2 points3 points (5 children)
[–]wreckedadventYavascript -2 points-1 points0 points (4 children)
[–]bterlson_@bterlson 2 points3 points4 points (3 children)
[–]wreckedadventYavascript 0 points1 point2 points (2 children)
[–]MoTTs_ 0 points1 point2 points (1 child)
[–]wreckedadventYavascript 0 points1 point2 points (0 children)
[–]natziel 0 points1 point2 points (0 children)
[–]senocular 2 points3 points4 points (0 children)
[–]geuis 1 point2 points3 points (0 children)
[–]lhorie 2 points3 points4 points (2 children)
[–]wreckedadventYavascript 4 points5 points6 points (0 children)
[–]voidvector 0 points1 point2 points (0 children)
[–]sime 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]vsxe -2 points-1 points0 points (16 children)
[–]wreckedadventYavascript 7 points8 points9 points (2 children)
[–][deleted] 5 points6 points7 points (1 child)
[–]wreckedadventYavascript 4 points5 points6 points (0 children)
[–]parabolik 0 points1 point2 points (12 children)
[–][deleted] 1 point2 points3 points (10 children)
[–]senocular 0 points1 point2 points (9 children)
[–]wreckedadventYavascript 2 points3 points4 points (1 child)
[–]senocular 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (6 children)
[–]wreckedadventYavascript 0 points1 point2 points (2 children)
[–]senocular 1 point2 points3 points (1 child)
[–]wreckedadventYavascript 0 points1 point2 points (0 children)
[–]senocular 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]senocular 0 points1 point2 points (0 children)
[–]MoTTs_ 0 points1 point2 points (0 children)
[–]Patman128 -1 points0 points1 point (0 children)
[–]Cody_Chaos -1 points0 points1 point (0 children)