Day 7: Generate a Christmas Tree in JavaScript
Submissions will no longer be placed on the leaderboard. You may still attempt this problem for practice.
Write a JavaScript program to generate the Christmas Tree pattern below. The tree should be composed of zeroes (0
), and it must be topped with an asterisk (*
).
*
0
000
00000
0000000
000000000
00000000000
0000000000000
000000000000000
00000000000000000
Note: The leftmost should be aligned with the left edge and there should not be any blank spaces preceding it on the last line.
Input Format
No input is required to complete this challenge.
xxxxxxxxxx
15
1
function processData(input) {
2
//Enter your code here
3
}
4
5
process.stdin.resume();
6
process.stdin.setEncoding("ascii");
7
_input = "";
8
process.stdin.on("data", function (input) {
9
_input += input;
10
});
11
12
process.stdin.on("end", function () {
13
processData(_input);
14
});
15