<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>focusout</title>
</head>
<body>
<script>
function normalizeArr(arr, cols, box) {
let lastElem = arr.pop();
for (let i = 0; i < cols; i++) {
if (lastElem[i] == undefined) {
lastElem[i] = box;}
}
arr.push(lastElem);
return arr;
}
console.log(normalizeArr(arr, 4, '-'));
</script>
</body>
</html