Skip to main content

Code Golf · #25 · 2026-04-29

Nth Fibonacci number

Difficulty 2/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 n (0-indexed), return the nth Fibonacci number. F(0)=0, F(1)=1.

Examples

f(6) 8
f(0) 0

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