Random Color Strings
copy R = Math .random b = document.body b.style = 'background: black; font-family: sans-serif; text-transform: uppercase; color: white;' setInterval( _ => { if ( R( ) < .9) { s = '' for ( i= 0 ; i< R( ) * 30 + 4 ; i++ ) s+= ( ~~( R( ) * 0xff) ) .toString ( 36 ) .replace ( R( ) < .9 ? /[0-9]/g : '' , '' ) b.innerHTML += ` < n style= "color:hsl(${R()*360}, 30%, 50%)" > ${ s} </ n> `+ ( R( ) < .1? '<br>' : '' ) ; } } , 100 )
Try it out…
Make some random strings and give them a random color… a friend of mine showed a work in progress forked codepen – so I created a golfed version/variation…
Building Spikes Codegolf
copy f = n=> ` ^ /| \\ / .| .\\ / ..| ..\\___`.replace ( /.[_|^]./g , '$&' .repeat ( n) ) + '____' // test it out document.body .innerHTML += `< pre> ${ f( 1 ) } ${ f( 3 ) } ${ f( 4 ) } `
Try it out…
Great codegolf stackexchange answer from user tsh
Fibonacci Triangle Golfed
copy // by Arnauld - https://codegolf.stackexchange.com/users/58563/arnauld f= ( n, a= b= 1 , p) => n? '' .padEnd ( p) + a+ `+ ${ b} = ${ b+= a} `+ f( n- 1 , b- a, ( a+ "" ) .length - ~p) : '' console.log ( f( 20 ) )
Try it out…
Great golfed solution to this question at codegolf stackexchange by user Arnauld
Alphabet Array Golfed
copy l= [ ] for ( i= 26 ; i--; ) l[ i] = ( 10 + i) .toString ( 36 ) console.log ( l)
Try it out…
A nasty golfed way to fill an array with letters a-z.
I usually do (as seen in another post ):
copy let letters = 'abcdefghijklmopqrstuvwxyz' .split ``
Bat Signal
copy document.body .innerHTML = '<pre>' + `n2zh2 f8l2b2l8 b8pep8 7cpepc 5ijiji 3yyq 0 0 0 3yyq 5afy8fa 98f69a96f8 f4f2d6d2f4`.replace ( /./g , c=> '* ' [ ( n= parseInt( c, 36 ) ) & 1 ] .repeat ( n/ 2 || 49 ) )
Try it out…
* *
**** * * ****
**** ******* ****
****** ******* ******
********* ********* *********
***********************************************
*************************************************
*************************************************
*************************************************
***********************************************
***** ********************* *****
**** *** ***** *** ****
** * *** * **
Fun js codegolf answer from user arnauld … Whole thread is very fun…