form
form copied to clipboard
Insert a new value in the middle of an array-like field
Assume I have the following array-like field
"friends": [ "James", "Julie", "John" ]
and I want to insert a fourth value between "James" and "Julie".
What would be the recommended way to accomplish this without calling pushFieldValue() followed by multiple swapFieldValue() calls?
I suppose one option would be to use setFieldValue()'s callback argument to manually splice the new value into the middle of the array.