Can a JavaScript object property refer to another property of the same object? [duplicate]
Not with object literals (this has the same value during constructing of the literal that it did before-hand). But you can do var carousel = new (function() { this.$slider = $(‘#carousel1 .slider’); this.panes = this.$slider.children().length; })(); This uses an object created from an anonymous function constructor. Note that $slider and panes are public, so can … Read more