You've got a nifty little program that collects a bunch of data, but it's returning data as it comes in in the form of an array. The data coming in is in a random order. That's not so good, because you want to be able to easily read and use this information. To make the data easier to manage, use a for loop to sort out your data by its type. Return an array with all the values in it, sorted by letters first, followed by numbers, then objects. Be aware that your nifty program sometimes returns nested arrays with their own elements in them. function separateDataTypes(arr) { For example, an array of [1,a,[2,3],b] Should return as [a,b,1,2,3].
function separateDataTypes(arr) { var letter = []; var number = []; var object = []; var output = []; for(var i = 0; i < arr.length; i++){ if(typeof arr[i] === 'number'){ number.push(arr[i]); } else if(typeof arr[i] === 'string'){ letter.push(arr[i]); } else if(typeof arr[i] === 'object'){ object.push(arr[i]); } } return output.concat(letter, number, object); } separateDataTypes([1,a,[2,3],b])