- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
Latest commit
27 lines (23 loc) · 528 Bytes
/
Copy pathscript.js
File metadata and controls
27 lines (23 loc) · 528 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
constcharacter='!';
constcount=10;
constrows=[];
letinverted=false;
functionpadRow(rowNumber,rowCount){
return(
' '.repeat(rowCount-rowNumber)+
character.repeat(2*rowNumber-1)+
' '.repeat(rowCount-rowNumber)
);
}
for(leti=1;i<=count;i++){
if(inverted){
rows.unshift(padRow(i,count));
}else{
rows.push(padRow(i,count));
}
}
letresult='';
for(constrowofrows){
result=result+row+'\n';
}
console.log(result);