Store and organize code in any programming language
JavaScript, Python, Java, C++, HTML, CSS, PHP, Ruby, Go, Rust, SQL, JSON, Markdown, and 40+ more
Code appears exactly as in your editor with proper colors for keywords, strings, comments, and functions
Search within code content to find that function you wrote months ago
Copy code with formatting preserved, perfect for sharing or pasting back into your editor
function calculateTotal(items) {
return items.reduce((sum, item) => {
return sum + item.price * item.quantity;
}, 0);
}
const cart = [
{ name: 'Laptop', price: 999, quantity: 1 },
{ name: 'Mouse', price: 25, quantity: 2 }
];
console.log(`Total: $${calculateTotal(cart)}`);
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
for i in range(10):
print(f"F({i}) = {fibonacci(i)}")