VIP 👤
🏠 Home
Benchmark Hub
📊 All Benchmarks 🦖 Dinosaur v1 🦖 Dinosaur v2 ✅ To-Do List Applications 🎨 Creative Free Pages 🎯 FSACB - Ultimate Showcase 🌍 Translation Benchmark
Models
🏆 Top 10 Models 🆓 Free Models 📋 All Models ⚙️ Kilo Code
Resources
💬 Prompts Library 📖 AI Glossary 🔗 Useful Links 🔌 API & Routers
beginner

Default Value Logic

#javascript #logic #variables

Use an empty string to handle missing user input.

Create a script that defines a variable `userName`. If `userName` is an empty string (""), assign the value 'Guest' to a variable called `displayName`. If `userName` has text, assign that value to `displayName`.