Skip to content

Commit

Permalink
Merge pull request #1071 from HajiraZareen/master
Browse files Browse the repository at this point in the history
colorful console
  • Loading branch information
NitkarshChourasia authored Jan 11, 2024
2 parents ac62cf1 + abbfd52 commit bd90fc2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions colorful console pattern.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function colorfulConsolePattern() {
const colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];
const patternSize = 10;

for (let i = 0; i < patternSize; i++) {
let line = '';

for (let j = 0; j < patternSize; j++) {
const randomColor = colors[Math.floor(Math.random() * colors.length)];
line += `%c${String.fromCharCode(9786)}`; // Unicode smiley
line += `color: ${randomColor};`;

if (j < patternSize - 1) {
line += ' ';
}
}

console.log(line);
}

console.log('Colorful Console Pattern!');
}

colorfulConsolePattern();

0 comments on commit bd90fc2

Please sign in to comment.