Steamroller

Developer
Size
1,888 Kb
Views
20,240

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 Previews

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]]] ]);
Steamroller - Script Codes
Steamroller - Script Codes
Home Page Home
Developer Victor Hall
Username vhall_io
Uploaded September 13, 2022
Rating 3
Size 1,888 Kb
Views 20,240
Do you need developer help for Steamroller?

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!

Victor Hall (vhall_io) Script Codes
Create amazing blog posts with AI!

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!