---
# System prepended metadata

title: Untitled

---

`學期一`

【學期 1 選修挑戰】

1. Modify the following code and use loops to print out the following:

```
const maxLength = 1;

for (...){
   …
}
```


```
maxLength = 1
Output:
*

maxLength = 3
Output:
*
**
***


maxLength = 5
Output:
*
**
***
****
*****
```





2. Change the code for question 1 and use loops to print out the following:

```
const maxLength = 1;

for (...){
   …
}
```

```

maxLength = 1
Output:
*

maxLength = 3
Output:
*
**
***
**
*

maxLength = 4
Output:
*
**
***
****
***
**
*
```





3. Change the code for question 2 and use loops to print out the following:

```
const maxLength = 1;

for (...){
   …
}
```


```
maxLength = 1
Output:
*

maxLength = 2
Output:
 *
* *
 *

maxLength = 3
Output:
  *
 * *
* * *
 * *
  *

maxLength = 4
Output:
   *
  * *
 * * *
* * * *
 * * *
  * *
   *
```



