Steamroller
How do I make an steamroller?
What is a steamroller? How do you make a steamroller? This script and codes were developed by Victor Hall on 13 September 2022, Tuesday.
Steamroller - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Steamroller</title>
</head>
<body> <h1>Challenge: Steamroller</h1> <script src="js/index.js"></script>
</body>
</html>
Steamroller - Script Codes JS Codes
function steamrollArray(arr) { // I'm a steamroller, baby //adds a dimension var add = []; //will be filled with final result var adjustedArr = []; //for this problem the top level array should only be about 3 iterations for(var i = 0; i < arr.length; i++){ //if this returns true then we need to add another dimension to it //this will loop through first dimension //if its not an array then we will just add it to own adusted array if(Array.isArray(arr[i])){//beginning of loop arr[i].push(add);//adds dimension //resembles [[x]] //loops through second dimension for(var j = 0; j < arr[i].length; i++){//beginning of inner loop if(Array.isArray(arr[i][j]) == true){//beginning of if //adds another dimension to goin deeper into array arr[i][j].push(add); //loops through new dimension for(var k = 0; k < arr[i][j].length;k++){//inner most loop //resembles [[[x]]] if(Array.isArray(arr[i][j][k]) == true){ //any deeper than [[[x]]] }else{//beginning of else adjustedArr.push(arr[i][j][k]); }//end of else }//end of inner most loop }else{//end of if adjustedArr.push(arr[i][j]); }//end of else }//end of inner loop }else{//end of first if statment adjustedArr.push(arr[i]); }//end of first else statment }//end of loop return adjustedArr; } steamrollArray([1, [2], [3, [[4]]] ]);
Developer | Victor Hall |
Username | vhall_io |
Uploaded | September 13, 2022 |
Rating | 3 |
Size | 1,888 Kb |
Views | 20,240 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Culinary Arts Institute at MCCC | 6,079 Kb |
Tribute Page | 3,131 Kb |
Drop it | 1,699 Kb |
Weather | 3,741 Kb |
Black Leopard | 2,001 Kb |
DNA pairing | 1,854 Kb |
Everything be true | 1,626 Kb |
Culinary Arts Institute | 6,040 Kb |
Roman Numerical Converter | 2,102 Kb |
Sum All Primes | 1,628 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Ripples in water | Nobitagit | 2,704 Kb |
Twinner Spinner II | Katydecorah | 2,974 Kb |
Flip test | Madhes | 1,635 Kb |
Flexbox playground | Enxaneta | 5,418 Kb |
Eunice A | Ejbronze | 2,203 Kb |
A Pen by Bryan Rojas | Bryanrojas | 1,873 Kb |
Nav Test -- cats 1 | Payls | 4,735 Kb |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Freecodecamp - Tribute Page | Samoht513 | 3,583 Kb |
Default Input, Textareas, Submits, and Buttons in iOS | Demersdesigns | 2,334 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!