I have a multidimensional array consisting of objects which is made by using below function.
   function createEmptyArray() {
        const col = 10;
        const row = 9;
        let cellData = [];
        for (let i = 0; i < row; i++) {
            cellData.push([]);
            for (let j = 1; j <= col; j++) {
                cellData[i][j] ={
                    x:i,
                    y:j,
                    revealed :true,
                    flag :false,
                    containsMine :false,
                    surroundingMines :0
                }
            }
        }
        return cellData;
    }
const newArray= createEmptyArray();
How can I deep clone this. I know there are various ways like JSON.parse(JSON.stringify(o)) and  $.extend(true, {}, o) but that creates many problems. JSON parsing method doesnot work when an object has a function.
 
     
    