Розкажіть нам, що сталося:
You should now see the same bunch of characters in your console. Your padRow function is doing the exact same thing you were doing earlier, but now it’s in a reusable section of its own.
Use the addition operator to concatenate a single space " " to the beginning and end of your repeated character string.
Remember that you can use the + operator to concatenate strings like this:
Не получается:(
Ваш код
const character = "#";
const count = 8;
const rows = [];
// User Editable Region
function padRow(rowNumber, rowCount) {
return character.repeat("" + rowNumber() + "");
}
// User Editable Region
for (let i = 0; i < count; i = i + 1) {
rows.push(padRow(i + 1, count));
}
let result = ""
for (const row of rows) {
result = result + "\n" + row;
}
console.log(result);
Інформація про ваш браузер:
Агент користувача: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
Інформація про завдання:
Вивчіть основи JavaScript, створивши генератор пірамід - Step 67