57 votes

Reserved JavaScript

43 words, 603 bytes Uhm, is this a loophole? I have no idea how the hell this is legal JS, but it works and it uses every single keyword. ...
user avatar
  • 769
56 votes

Tips for golfing in JavaScript

Shorter random number generation If you need a random boolean (0 or 1): ...
user avatar
  • 70.5k
56 votes

Reserved JavaScript

37 words ...
user avatar
  • 29k
53 votes

Tips for Golfing in ECMAScript 6 and above

Spread operator ... The spread operator transforms an array value into a comma separated list. Use case 1: Directly use an array where a function expects a list ...
user avatar
  • 31.8k
52 votes
Accepted

Red vs. Blue - Pixel Team Battlebots

Blue Team - SphiNotPi3000 ...
user avatar
  • 28.5k
49 votes

Red vs. Blue - Pixel Team Battlebots

Blue Team - SphiNotPi3000 ...
user avatar
  • 60.9k
48 votes
Accepted

Making Future Posts Runnable Online with Stack Snippets

Python 2 (No STDIN) Thanks to Skulpt, it has become very easy to write a Python interpreter. ...
user avatar
  • 986
36 votes

Get string "-" with JavaScript using only the symbols from "+[]"

260 ... 210  205 bytes Saved 5 bytes thanks to @user202729 ...
user avatar
  • 167k
34 votes

xkcd 2385 KoTH (Final Exam)

Game Theory is stupid anyway { name: "Game Theory is stupid anyway", run: _ => 100 } Senioritis hits hard sometimes.
user avatar
  • 3,931
33 votes

Tips for golfing in JavaScript

Unicode shortcuts If you use a hell of a built-in property at a big golfing challenge you can alias every property to a one character equivalent: ...
user avatar
  • 4,204
33 votes

Making Future Posts Runnable Online with Stack Snippets

Befunge-93 Edit: I reworked the entire GUI now. I'm much happier with it. Some kind of breakpoint feature would be cool, but it's probably too much for this. Open Points I will probably revisit: ...
user avatar
  • 2,734
33 votes

Making Future Posts Runnable Online with Stack Snippets

TI-BASIC 'cause who doesn't like TI-Basic? I wanted to contribute to this, so I picked a language that is (in my humble opinion) slightly more complicated than, say, Deadfish, but within my control. ...
user avatar
32 votes

Reserved JavaScript

43 words, 302 299 bytes ...
user avatar
  • 12.8k
30 votes
Accepted

JSF**k with only 5 symbols?

After brainstorming, the result seems to be that, on modern browsers at least, there’s no way to do this. I’ll try to summarize the entire process, adding some reasoning about why we’ve exhausted our ...
user avatar
  • 65.7k
28 votes

xkcd 2385 KoTH (Final Exam)

Balanced Strategy What could be more balanced than returning all of the numbers? Rotates by one after every game. ...
user avatar
  • 281
27 votes

Tips for Golfing in ECMAScript 6 and above

Using property shorthands Property shorthands allow you to set variables to an arrays' values: a=r[0];b=r[1] // ES5 [a,b]=r // ES6 - 6 bytes saved This ...
user avatar
  • 28.4k
26 votes

Making Future Posts Runnable Online with Stack Snippets

Brainfuck Here's a basic BF interpreter. There's no debugger though, but has a couple of customisation options. ...
user avatar
  • 60.9k
24 votes

Tips for golfing in JavaScript

Exception abusing in case string/character literals are prohibited, you can use a try catch block: try{something0}catch(e){str=e.message.split(0)[0]} now ...
user avatar
  • 4,204
24 votes

Tips for golfing in JavaScript

Use ^ instead of != or == when comparing to an integer ...
user avatar
24 votes
Accepted

Is it possible to make a clamp function shorter than a ternary in JS?

20 bytes For reference, this is the original version without whitespace and without naming the function: n=>n>0?n<255?n:255:0 Try it online! 19 bytes We ...
user avatar
  • 167k
24 votes
Accepted

xkcd 2385 KoTH (Final Exam)

Offset Prediction I'd made a bot that just optimizes for the moving average of the averages (which worked reasonably well), and while testing I noticed that the actual averages seem to jump around the ...
user avatar
  • 1,561
23 votes

Tips for golfing in JavaScript

Array sum / product / quotient ES5: 17 bytes eval(a.join('+')) ES6: 15 bytes eval(a.join`+`) Of course you can swap the <...
user avatar
  • 2,534
23 votes

Tips for Golfing in ECMAScript 6 and above

Tricks learned here since I joined My primary programming language is JS and mostly ES6. Since I joined this site a week back, I have learned a lot of useful tricks from fellow members. I am ...
user avatar
  • 26.3k
23 votes

xkcd 2385 KoTH (Final Exam)

Sam (Self-Aware Maximizer) Finds the output cybersecurity score that maximizes the total score including the own output in the mean. Assumes that the sum of all other bots' scores is going to be the ...
user avatar
  • 331
22 votes
Accepted

Check If Two or More Variables Are All Equal to Zero in JavaScript

(EDIT: This first part refers to the original phrasing of the question.) First, (!x&&!y&&!z) returns a boolean, which makes ...
user avatar
22 votes

xkcd 2385 KoTH (Final Exam)

Max Max. { name: "Max", max: "max", run:(max)=> Math.max(...max) }
user avatar
  • 25.2k
22 votes

xkcd 2385 KoTH (Final Exam)

getRandomNumber ...
user avatar
21 votes

Tips for golfing in JavaScript

If you need to check for NaN, don't use isNaN(x), but use x!=x, which is shorter and also works. ...
user avatar
  • 8,253
21 votes

Making Future Posts Runnable Online with Stack Snippets

Marbelous* This interpreter is probably filled with bugs; if you find any, please let me know. This supports all features of Marbelous except #include. There is ...
user avatar
  • 9,175
21 votes

Red vs. Blue - Pixel Team Battlebots

Red Team - SeekerBot ...
user avatar
  • 311

Only top scored, non community-wiki answers of a minimum length are eligible