replace
replace :: (Number index, Any value, Array input) => Array outputdescription
Returns a new array after replacing the value at the provided index with the provided value in the input array. If the index is not found, the input array is simply (shallow) cloned.
Like nearly all methods in conductor, replace is a pure function and will not modify the input array.
example
import { replace } from 'conductor'
const numbers = [3, 1, 1]
replace(2, 4, numbers) // [3, 1, 4]Here, we simply replaced the value at index 2 by the value 4.
Last updated