Skip to content

Instantly share code, notes, and snippets.

@inspector-ambitious
Created December 15, 2021 10:47
Show Gist options
  • Save inspector-ambitious/72c2949eb7c1ffb76c800b0157e4eaab to your computer and use it in GitHub Desktop.
Save inspector-ambitious/72c2949eb7c1ffb76c800b0157e4eaab to your computer and use it in GitHub Desktop.
Deep copy array
// 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