Created
December 15, 2021 10:47
-
-
Save inspector-ambitious/72c2949eb7c1ffb76c800b0157e4eaab to your computer and use it in GitHub Desktop.
Deep copy array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1: Deep copy a jagged array with numbers or other arrays in a new array | |
const originalArray = [2, 4, 10, [12, 4, [100, 99], 4], [3, 2, 99], 0]; | |
const deepCopyArray = (array) => { | |
}; | |
console.log("## deepCopyArray"); | |
console.log(deepCopyArray(originalArray)); | |
// Step 2: Render jagged array in document body using semantic HTML | |
// example: | |
// <ul> | |
// <li>2</li> | |
// <li>4</li> | |
// <li>10</li> | |
// <ul> | |
// <li>12</li> | |
// <li>4</li> | |
// <ul> | |
// etc... | |
// </ul> | |
// </ul> | |
const renderJaggedArray = (array, rootEl) => { | |
}; | |
console.log(renderJaggedArray(originalArray, document.body)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment