Alphabet Array Golfed
l=[]
for(i=26;i--;)l[i]=(10+i).toString(36)
console.log(l)
A nasty golfed way to fill an array with letters a-z.
I usually do (as seen in another post):
let letters = 'abcdefghijklmopqrstuvwxyz'.split``
Bat Signal
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))
* *
**** * * ****
**** ******* ****
****** ******* ******
********* ********* *********
***********************************************
*************************************************
*************************************************
*************************************************
***********************************************
***** ********************* *****
**** *** ***** *** ****
** * *** * **
Fun js codegolf answer from user arnauld… Whole thread is very fun…
Martin Kleppe’s Golfed Blobs Quine
<pre id=p style=background:#000><svg onload='setInterval(f=n=>
{for(t++,o=i=1;i++<476;o+=i%30?([(f+"")[i%195],"o"][c=0|(h=v=>
(M=Math).hypot(i/30-8+3*M.sin(t/8/v),i%30/2-7+4*M.cos(t/9/v)))
(7)*h(9)*h(6)/52]||".").fontcolor(c?c>2:n):"\n");p.innerHTML=o},t=1)'>
Great golfed snippet from Martin Kleppe – can’t wait to fork it… 😀
This was updated a bit later to be even smaller:
<body onload='setInterval(f=n=>{for(t++,o=i=1;i++<476;o+=i%30?([(f+f)[i],"o"][c=0|(h=v=>(M=Math).hypot(i/30-7+3*M.sin(t/8/v),i%30/2-7+4*M.cos(t/9/v)))(7)*h(9)*h(6)/52]||".").fontcolor(c?c>2:n):"\n");p.innerHTML=o},t=1)'bgcolor=X><pre id=p>
Alphabet Array JavaScript
const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('')
console.log(alphabet);
// outputs: ['a', 'b', 'c', ... 'z']
Create an array of the alphabet.
Splitting a string with an empty string results in each character being placed into a slot in the new array.