My array looks like this:
var arr = ['one', 'two', ['three', 'four']];
When attempting to use arrow functions to return each element, the third element shows up as undefined
instead of the actual values. I've tried restructuring it without success. While I could resort to using a for loop and push method, I prefer to grasp how to properly utilize arrow functions in situations like this.
arr.map(e => {
if(typeof(e) == "object"){
e.map(t => t)
} else{ return e; }
})
Any insights on this issue would be greatly appreciated. The desired output should be an array like so: ['one', 'two', 'three', 'four'].