by btipling on 8/24/14, 2:55 PM with 45 comments
by yoran on 8/24/14, 7:58 PM
by bshimmin on 8/25/14, 12:57 PM
1) JavaScript is starting to become a "big" language, in terms of number of keywords and syntax;
2) While many of these things that JavaScript is (finally) gaining are things we're familiar with in other languages (and have empirically found to be useful), they often seem somewhat more unwieldy, fiddly, and complicated in JavaScript.
As a handwavy example, Ruby generally has most of the stuff these sorts of articles describe, and it can be complicated at times, but usually (in my experience) only when you're trying to do something complicated anyway; in JavaScript, a lot of it looks quite complicated out of the box even when you're doing something that ought to be simple.
There are many JavaScript developers out there, some with years of experience, who are confused about, say, `var Foo = function() {}` versus `function Foo() {}`, or the difference between `new Foo()` and `Object.create(Foo.prototype)`. To be honest, it slightly worries me that even more complexity is being added at this point.
by VeejayRampay on 8/24/14, 9:30 PM
by jvickers on 8/24/14, 7:42 PM
Have a single polymorphic function called type: type() gets the type, type(value) sets the type.
Have .get and .set functions, called like: get('type'), set('type', value).
by tomphoolery on 8/25/14, 4:31 AM
var foo = {};
Is it really necessary to define properties on it with this notation? Object.defineProperty(foo, 'bar', { value: 'baz' });
Since foo itself is an Object, wouldn't it also have this method? Why can't I define a property on foo like this? foo.defineProperty('bar', { value: 'baz' });
by Excavator on 8/24/14, 9:54 PM
1: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
by wging on 8/24/14, 11:27 PM
Careful. These have different behavior for own properties which are not enumerable. A for-in loop doesn't include them, but Object.getOwnPropertyNames does.
by elwell on 8/24/14, 8:43 PM