One LinerCreate 2D arrayCreate 2D arrayJavascriptTypescriptconst generateArray = (n) => Array(n).fill(0).map(_ => Array(n).fill(0)); Example generateArray(3); // [[0,0,0],[0,0,0],[0,0,0]]Last Update: 05:54 - 19 April 2024PreviousXSS and XSRFNextCreate array from 1 to nOn this page