All Tracks/lab pyramid generator/
Đang tải...
Hướng dẫn thử thách
1 / 1

Build a Pyramid Generator

**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab. **User Stories:** 1. You should have a function named `pyramid` that takes three arguments. 1. The first argument should be a string representing the pattern character to repeat in your pyramid. 1. The second argument should be an integer representing the number of rows in the pyramid. 1. The third argument should be a Boolean value. 1. The `pyramid` function should return a string in which the pattern character is repeated and arranged to form a pyramid having the vertex facing upwards when the third argument is `false`. 1. When the third argument is `true` the pyramid should have the vertex facing downwards. 1. The vertex row should have a single pattern character, and each other row should have two pattern characters more than the previous one. 1. Each row should start with a number of spaces sufficient to put the center character of each row in the same column and there should not be any spaces at the end of each row. 1. The pyramid should start and end with a newline character. For example, calling `pyramid("o", 4, false)` should give this output: ```js o ooo ooooo ooooooo ```
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.js
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.