Built-in Utilities
Bun provides many built-in utilities that would normally require external packages in Node.js. Let's explore these time-saving features.
String Utilities
Bun includes fast string manipulation functions:
Loading Bun Playground...
Deep Comparison
Compare complex objects without external libraries:
Loading Bun Playground...
Garbage Collection
Manually trigger garbage collection when needed:
Loading Bun Playground...
Binary Data with ArrayBufferSink
Efficiently build binary data:
Loading Bun Playground...
Environment Variables
Access environment variables through Bun.env:
Loading Bun Playground...
Exercise: Safe HTML Display
Create a function that safely renders user content:
Loading Bun Exercise...
Exercise: Object Differ
Create a function that checks if two objects have changed:
Loading Bun Exercise...
Exercise: Content Hasher
Create a utility to generate content hashes:
Loading Bun Exercise...

