I have an array
var arr = ['(', '1', 'AND', '2', ')', 'OR', '(', '3', 'AND', '4', ')']
First I want to find if my array contains a element if have that element then replace it with another string.
I have tried following
arr.find(element=>{
if(element == 1){
var elementIndex = arr.indexOf(1);
arr[elementIndex] = "Name = Test";
}
})
Here I'm searching for "1" in array. But always give me output as -1.
what I am doing wrong?