I am facing problem to change the index values of an array according to given index in javaScript. i have searched on StackOverflow and found some solution but those not working for me of are not for javaScript. The below input array and index is mentioned.
Input: arr[] = [101, 102, 103];
index[] = [1, 0, 2];
Output: arr[] = [102, 101, 103]
index[] = [0, 1, 2]
The founded answers are reorder array according to given index
php - sort an array according to second given array
Rearrange an array according to key
Sorting an Array according to the order of another Array
Any kind of hint/solution is highly appreciated.