Free · No sign-up · Runs in your browser

Write code. See it come to life.

A fast, free playground for JavaScript, TypeScript, and React. Test ideas, practice coding challenges, and build components with instant feedback.

1const nums = [3, 1, 2]
            2const sorted = nums.toSorted((a, b) => a - b)
            3console.log(sorted)
            4
            5const counts = new Map()
            6for (const ch of 'hello') {
            7  counts.set(ch, (counts.get(ch) ?? 0) + 1)
            8}
            9console.log(counts)

Done in 2 ms

[1, 2, 3]L3

Map(4) { 'h' => 1, 'e' => 1, 'l' => 2, 'o' => 1 }L9

Everything you need to practice