From 69e8f840753b54184f735ca3f379765bf9d1ad63 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 16 Dec 2017 13:40:52 +0200 Subject: [PATCH] Update 3DigHexcode-to-6DigHexcode.md --- snippets/3DigHexcode-to-6DigHexcode.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/snippets/3DigHexcode-to-6DigHexcode.md b/snippets/3DigHexcode-to-6DigHexcode.md index d424f41cd..2e9b9b8fc 100644 --- a/snippets/3DigHexcode-to-6DigHexcode.md +++ b/snippets/3DigHexcode-to-6DigHexcode.md @@ -1,12 +1,11 @@ ### 3DigHexcode to 6DigHexcode -Use `Array.map()` to map the array created by `String.split()` and `Array.join()` to join -the mapped array for converting a three-digit RGB notated hexadecimal colorcode to the six-digit form. +Use `Array.map()`, `split()` and `Array.join()` to join the mapped array for converting a three-digit RGB notated hexadecimal colorcode to the six-digit form. ```js const convertHex = shortHex => shortHex[0] == '#' ? ('#' + shortHex.slice(1).split('').map(x => x+x).join('')) : - ('#' + shortHex.split('').map(x => x+x).join('')) + ('#' + shortHex.split('').map(x => x+x).join('')); // convertHex('#03f') -> '#0033ff' // convertHex('05a') -> '#0055aa' ```