[Javascript] code review

Mike Dougherty mdougherty at pbp.com
Wed Aug 4 08:23:37 CDT 2004


Given the rather long object tree below, was there a better way to structure the data/objects so 
this kind of code could have been avoided?  (there are few objects in each collection, and it 
processes very quickly even on slow machines, but it's not pleasant to read)


for (var itm200 in loMainItem.Item0200) {
	var loItm200 = loMainItem.Item0200[itm200]
	for (var itm100 in loItm200.Item0100) {
		var loItm100 = loItm200.Item0100[itm100]
		for (a100 in loItm100.Area0100) {
			var loA100 = loItm100.Area0100[a100]
			if (loA100.Customize==1) {
				for (a110 in loA100.Area0110) {
					var loA110 = loA100.Area0110[a110]
					if (loA110.Type==2) {
						if (loA110.Customize==1) {lnRtnVal+=1}
						} /* if (loA110.Type==2) */
					} /* for (a110 in loA100.Area0110) */
				} /* if (loA100.Customize==1) */
			} /* for (a100 in loItm100.Area0100) */
		} /* for (itm100 in loItm200.Item0100) */
	} /* for (itm200 in loMainItem.Item0200) */



More information about the Javascript mailing list