Questions tagged [javascript]
This challenge is related to the JavaScript language. Note that challenges that require the answers to be in a specific language are generally discouraged.
110 questions
1 vote
2 answers
228 views
Create an autoclicker for Bands and Bonds
Bands and Bonds is a browser clicker game about delving in a dungeon. It has the particularity that only one of the actions you may take can be auto-repeated at the same time: You may start several ...
10 votes
1 answer
1k views
0 votes
0 answers
269 views
Shortest Float32Array to Int32Array conversion for audio processing
I'm currently converting a Float32Array to an Int32Array for input to a real-time audio raw PCM to MP3 recording application. <...
12 votes
3 answers
1k views
Point-free JavaScript: write a function runner
In this programming-puzzle, your goal is to write the following function in JavaScript, using (essentially) point-free (tacit) programming: (f) => void(f()) ...
-4 votes
1 answer
286 views
Comparator function in Javascript [closed]
Need to write a JS function compare(a,b) for numbers which return 1 when a > b, 0 when a == b, -1 when a < b. Also following properties should hold: compare(NaN, NaN) = 0 NaN is bigger than any ...
6 votes
0 answers
468 views
Crazyhouse chess KoTH
What is Crazyhouse Chess? Crazyhouse Chess is a chess variant that is basically normal chess except you can place a piece you previously captured back on the board instead of a regular turn. Bot ...
3 votes
2 answers
546 views
Golf my variables (and code)!
Specifically, this references JavaScript, a programming language that happens to be one you can run on StackExchange/StackOverflow. However, you may use any programming language to do this challenge. ...
5 votes
3 answers
952 views
Tips for shortening this type-safe addition in JavaScript
Consider: c=(a,b)=>(+a||0)+(+b||0) Yes, it is not good to solve it like that. But I want to shorten it even more. If a is a ...
15 votes
2 answers
2k views
Can `a?b<c:b>c` be shortened in Javascript?
So I have the situation where I have one boolean value a and, if that one is true and b<c ...
13 votes
2 answers
407 views
Shortest way to coerce to array
Given a variable a (non array) or (any[]) convert to (any[]) function example(s: string | string[]) { const e = Array.isArray(s) ? s: [s] return e } Is ...
3 votes
2 answers
287 views
Tips for parsing Standard Input in JavaScript
I've been doing quite a few code golf recently and I realised that a lot of times, I have to do something involving list. Most of the times lists are space-separated or comma-separated values in the ...
12 votes
4 answers
981 views
Tron Light-Cycle KotH
Basically the tron light-cycle game as a king of the hill competition! Leaderboard Updated as of 2022-04-05 ...
12 votes
0 answers
445 views
Chess Squad March
Find the moves that bring a chess squad to a given destination. You control a chess squad consisting of a king and several other pieces, on a larger chess board. Your army is placed so that no piece ...
18 votes
14 answers
3k views
King of the Hill: Nose Poker - An ogre game for ogres
Links Chat room The official game report Github repo - In case of bugs to report Here's the official score table: ...
9 votes
3 answers
591 views
Turn-based RPS Poker
This is a two-player card game which resembles a vastly simplified game of Texas Hold'em, combined with RPS (rock-paper-scissors) and the most basic mechanic of commercial turn-based card games. The ...