Skip to content

Commit fb445b4

Browse files
committed
Fix color indexes
1 parent 3124612 commit fb445b4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

JavaScript/1-basics.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
const SALUTATION = 'Ave';
66

77
const COLORS = [
8-
/* 1 */ 'black',
9-
/* 2 */ 'red',
10-
/* 3 */ 'green',
11-
/* 4 */ 'yellow',
12-
/* 5 */ 'blue',
13-
/* 6 */ 'magenta',
14-
/* 7 */ 'cyan',
15-
/* 8 */ 'white'
8+
/* 0 */ 'black',
9+
/* 1 */ 'red',
10+
/* 2 */ 'green',
11+
/* 3 */ 'yellow',
12+
/* 4 */ 'blue',
13+
/* 5 */ 'magenta',
14+
/* 6 */ 'cyan',
15+
/* 7 */ 'white'
1616
];
1717

1818
// Functions
@@ -22,10 +22,10 @@ const colorer = (s, color) => `\x1b[3${color}m${s}\x1b[0m`;
2222
const colorize = name => {
2323
let res = '';
2424
const letters = name.split('');
25-
let color = 1;
25+
let color = 0;
2626
for (const letter of letters) {
2727
res += colorer(letter, color++);
28-
if (color > COLORS.length) color = 1;
28+
if (color > COLORS.length) color = 0;
2929
}
3030
return res;
3131
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy