Skip to main content

Code Golf · #58 · 2026-06-01

Repeat a 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 an array [string, n], return the string repeated n times.

Examples

f(["ha",3]) hahaha
f(["ab",2]) abab

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