These are my two arrays. I want sizeIdArray to get sorted on the basis of sizesNameArray. For Example,
sizeIdArray = [1, 2, 3];
sizeNameArray = [2.5m, 8m, 3.5m];
After sorting sizeNameArray,
sizeNameArray = [2.5m, 3.5m, 8m];
and
sizeIdArray should be [1, 3, 2];
How do i attain this? I was able to obtain the sizeNameArray by this method.
sizesNameArray.sort(function(a,b){return parseFloat(a.replace('#', ''))-parseFloat(b.replace('#', ''))})
replace function is if there was '#' in front.
Sorry if i am not clear with my question. I want to sort both at the same time, but sizeIdArray should be sorted according to sizeNameArray.
Please help. Thank You