Skip to main content

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.

Filter by
Sorted by
Tagged with
10 votes
1 answer
1k views

Not great at regexs. Trying to code-golf this beast of a regex WITHOUT using string replacement (for G-Zip purposes)

Here it is: ...
Overflow2341313's user avatar
0 votes
0 answers
179 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. <...
guest271314's user avatar
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()) ...
rydwolf's user avatar
  • 18.9k
-4 votes
1 answer
238 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 ...
Ihromant's user avatar
6 votes
0 answers
385 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 ...
user avatar
3 votes
2 answers
436 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. ...
Infigon's user avatar
  • 571
5 votes
3 answers
881 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 ...
Felix Schönherr's user avatar
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 ...
Julian Wagner's user avatar
13 votes
2 answers
354 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 ...
ThomasReggi's user avatar
3 votes
2 answers
240 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 ...
CreaZyp154's user avatar
12 votes
4 answers
856 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 ...
thesilican's user avatar
11 votes
0 answers
387 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 ...
Valentin Brasso's user avatar
18 votes
14 answers
2k 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: ...
AJFaraday's user avatar
  • 11.8k
9 votes
3 answers
522 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 ...
Bubbler's user avatar
  • 78.2k
4 votes
7 answers
470 views

Time bomb (KoTH) [duplicate]

In this challenge, players need to tamper with a time bomb as late as possible without getting blasted in the face. Mechanics Let N be the number of bots plus one. ...
leo3065's user avatar
  • 477

15 30 50 per page
1
2 3 4 5
8