Hágalo de manera que organice las cadenas de manera diferente a los tipos de números. es decir, [1, "2", "3", 2] debería devolver [[1,2], ["2", "3"]]
const stringArray = [1, "2", "3", 2]; function checkArrayString(arr){ let emptyArray = []; let emptyArray2 = []; let emptyArray3 = []; for(let j=0; j<arr.length; j++){ if(arr[j]===`${arr[j]}`){ //looping to find string values in array console.log("working"); emptyArray.push(arr[j]); emptyArray3.push(emptyArray); } else{ console.log("see five working"); emptyArray2.push(arr[j]); emptyArray3.push(emptyArray2); } } return emptyArray3; }