Suppose I have a JavaScript array that looks like this:
arrTest = [
{qId: 1, text:"test a", order: 1},
{qID: 2, text:"test b", order: 2},
{qID: 3, text:"test c", order: 3},
{qID: 4, text:"test d", order: 4}
];
My goal is to randomize only the values in the 'order' key while keeping all other keys unchanged and preserving the original order of the array:
arrTest = [
{qId: 1, text:"test a", order: 3},
{qID: 2, text:"test b", order: 1},
{qID: 3, text:"test c", order: 4},
{qID: 4, text:"test d", order: 2}
];
I've come across various discussions and functions for randomizing arrays, but none seem to specifically target a single key while leaving everything else intact.
If you have any advice or solutions, it would be greatly appreciated!
Thank you in advance!