I have a integer array
array = [1,1,1,1,0,0,0,0]
that I want to convert to a string array based on the following logic:
for(var index in arr){
if(arr[index] == 0){
arr[index] == 'Closed'
}
else{
arr[index] == 'Open'
}
}
In order to get the following output
arr = ['open','open','open','open','closed','closed','closed','closed']
But the code is not executing correctly. Can you not assign strings to arrays in Javascript? Any help would be appreciated.