Timeline for Tips for golfing in JavaScript
Current License: CC BY-SA 3.0
26 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 28, 2021 at 17:42 | comment | added | Alex bries |
top is shorter than self or this, and it works in local context too
|
|
| S May 10, 2017 at 18:37 | history | edited | Riker | CC BY-SA 3.0 |
Added to section on property access
|
| S May 10, 2017 at 18:37 | history | suggested | Artyer | CC BY-SA 3.0 |
Added to section on property access
|
| May 10, 2017 at 18:36 | review | Suggested edits | |||
| S May 10, 2017 at 18:37 | |||||
| Apr 13, 2017 at 12:39 | history | edited | Community Bot |
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
|
|
| May 24, 2016 at 6:44 | comment | added | Cyoce |
Instead of ~~a+~~b, I think you can use ~-a-~b
|
|
| Feb 13, 2016 at 9:33 | comment | added | removed |
Instead using document.getElementById('X').something, just X.something works as well
|
|
| May 7, 2015 at 0:28 | comment | added | SuperJedi224 | @zzzzBov: In code golf, that is usually true, but that's still a point that's worth mentioning. | |
| May 6, 2015 at 21:35 | comment | added | zzzzBov |
@SuperJedi224, continue is far too many characters to be worthwhile. Avoid it.
|
|
| May 6, 2015 at 20:50 | comment | added | SuperJedi224 |
Again, for loops and the stated while loop equivalent will differ in how they handle continue keywords.
|
|
| Feb 20, 2015 at 2:37 | history | wiki removed | Doorknob | ||
| Sep 11, 2014 at 14:40 | comment | added | Martin Ender |
For "Use Array-Access for repeat function calls" if you're using the function more than twice on the same object, what's a bit shorter is to assign the function to a new member like a.f=a.longfunctionname;a.f(b);a.f(c);a.f(d)
|
|
| Jan 16, 2014 at 11:46 | comment | added | imma | +a+b doesn't work (at least on mine...) // a="1",b="1",+a+b // gives "11" | |
| Dec 19, 2013 at 14:21 | comment | added | John Dvorak |
I swear I'm going to use d- -b in my code someday...
|
|
| Aug 1, 2012 at 10:23 | comment | added | Inkbug | Where can I add github.com/jed/140bytes/wiki/Byte-saving-techniques ? | |
| Apr 24, 2012 at 16:31 | vote | accept | mellamokb | ||
| S Apr 4, 2012 at 1:58 | history | suggested | Community Bot | CC BY-SA 3.0 |
Add casting sum tip
|
| Apr 4, 2012 at 1:51 | review | Suggested edits | |||
| S Apr 4, 2012 at 1:58 | |||||
| Mar 5, 2012 at 17:21 | history | edited | zzzzBov | CC BY-SA 3.0 |
edited body
|
| Mar 5, 2012 at 17:19 | history | rollback | zzzzBov |
Rollback to Revision 3
|
|
| Dec 2, 2011 at 21:38 | comment | added | Peter Olson |
It's cheaper to coerce a string to a number with the unary plus operator. If a and b are strings, you can do +a+b to convert to number and add them.
|
|
| Aug 27, 2011 at 22:47 | history | edited | Casey Chu | CC BY-SA 3.0 |
"self" is not magical like "this"
|
| Aug 25, 2011 at 19:33 | history | edited | zzzzBov | CC BY-SA 3.0 |
added 1223 characters in body
|
| Jun 1, 2011 at 21:31 | history | edited | zzzzBov | CC BY-SA 3.0 |
edited body
|
| Jun 1, 2011 at 19:48 | comment | added | mellamokb |
c = ~~a-~~b should be c = ~~a+~~b. Also, you can implicitly cast to integer using |0, for example Math.random()*6|0.
|
|
| Jun 1, 2011 at 16:55 | history | answered | zzzzBov | CC BY-SA 3.0 |