Timeline for Tips for golfing in JavaScript
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 13, 2018 at 16:19 | comment | added | l4m2 | what about '12345'.replace(/(..)./,'$1d') | |
| Mar 2, 2018 at 6:48 | comment | added | Stan Strum | Also, s.split``[0] or ...s[0] | |
| Sep 7, 2016 at 2:26 | comment | added | ETHproductions | @yonatanmn That's a smart workaround, but I think it really only works when you know exactly what the string is. | |
| Apr 23, 2016 at 9:08 | comment | added | yonatanmn | @ETHproductions try: a=s.split('e').join('d'); And for this case (2 L's) - s.split('ll').join('ld'); | |
| Dec 22, 2015 at 1:08 | comment | added | ETHproductions | Too bad JS doesn't support a[3]="d". Instead we have to use the obnoxiously long a=a.slice(0,3)+"d"+a.slice(4). | |
| Feb 20, 2015 at 2:37 | history | wiki removed | Doorknob | ||
| Feb 24, 2014 at 10:37 | comment | added | Toothbrush | @xfix Yes, it's defined in EcmaScript 5, but Firefox has supported it from version 0.9. | |
| Jan 4, 2013 at 12:03 | comment | added | null | This is EcmaScript 5, but for code golf it's fine. | |
| Apr 5, 2012 at 18:33 | history | answered | Griffin | CC BY-SA 3.0 |