KOSASIH / SilkRoad

Initialization in variable declarations against recommended approach JS-0119
Anti-pattern
Minor
8 months agoa year old
Variable 'option' should be initialized on declaration
3806		this.onKeyDown = (function() {
3807			var original = self.onKeyDown;
3808			return function(e) {
3809				var index, option;3810				if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
3811					index = this.caretPos - 1;
3812					if (index >= 0 && index < this.items.length) {
Variable 'index' should be initialized on declaration
3806		this.onKeyDown = (function() {
3807			var original = self.onKeyDown;
3808			return function(e) {
3809				var index, option;3810				if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
3811					index = this.caretPos - 1;
3812					if (index >= 0 && index < this.items.length) {
Variable 'i' should be initialized on declaration
3654		};
3655	
3656		var equalizeSizes = function() {
3657			var i, n, height_max, width, width_last, width_parent, $optgroups;3658	
3659			$optgroups = $('[data-group]', self.$dropdown_content);
3660			n = $optgroups.length;
Variable 'n' should be initialized on declaration
3654		};
3655	
3656		var equalizeSizes = function() {
3657			var i, n, height_max, width, width_last, width_parent, $optgroups;3658	
3659			$optgroups = $('[data-group]', self.$dropdown_content);
3660			n = $optgroups.length;
Variable 'height_max' should be initialized on declaration
3654		};
3655	
3656		var equalizeSizes = function() {
3657			var i, n, height_max, width, width_last, width_parent, $optgroups;3658	
3659			$optgroups = $('[data-group]', self.$dropdown_content);
3660			n = $optgroups.length;