I have created a function to add a value to an existing array. When i try to access the new array which is newArr22, it says "Uncaught ReferenceError: newArr22 is not defined". I can access the value when its not inside a function. What am I doing wrong ?
const initialArr = [
{name: 'eve'},
{name: 'john'},
{name: 'jane'}
]
function newarr(){
const newArr22 = initialArr.map(v => ({...v, isActive: true}))
}