for(i=1; i<=n; i++){ for(j=i+1; j<=n; j++){ this["r"+i+"_"+j] = getDistance(this["mc"+i], this["mc"+j]); } }