Skip to main content

Code Golf · #33 · 2026-05-07

Decimal to binary string

Difficulty 1/3 · JavaScript

How to play

Write a JavaScript function body that passes all test cases using the fewest characters. Run against examples first, then submit for the full test suite. Eagle < Birdie < Par.

Given a non-negative integer, return its binary representation as a string.

Examples

f(10) 1010
f(255) 11111111

Loading your progress...

Your code (function body — receives input)

function(input) { 0 chars
}

Write the shortest JavaScript function body that passes all tests · Back to hub