Tell us what’s happening:
How may i set to split it with double quotes? I have to finish 3 tasks of the challenge, but I do not know how to set the double quotes. And what may I do in this casesteamrollArray([1, {}, [3, [[4]]]]) should return [1, {}, 3, 4] .?
Your code so far
function steamrollArray(arr) {
console.log(arr.join("").split(""))
let b = arr.join().replace(/,/g,"")*1
var digits = b.toString().split('');
var realDigits = digits.map(Number)
console.log(realDigits);
//return realDigits
}
steamrollArray([[["a"]], [["b"]]])
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.
This challenge can be solved by turning the array into a string and manipulating that string, but it’s really not the way that it’s intended to be solved.
You have the start of recursion but you aren’t using recursion. You steamroll x if it is an array, but you need to use that steamrolled version of x to update newArr.
As Jeremy said, you shouldn’t have a global variable. You also aren’t returning anything from your steamrollArray or doing anything with the value that should be returned by steamrollArray(x).