Random Title Generator

Опубликовано: 19 Май 2026
на канале: Restful Coder
141
5

Learn how to make a random title generator,with multiple random parts.

This is a great video for beginners and intermediate programmers. The problem is fairly simple, but I use it as an opportunity to show some intermediate refactoring techniques that touch on SOLID principles.

Here's the code. You can copy it, create a Vanilla JS sandbox at codesandbox.io, and paste it over the contents of index.js.
https://gist.github.com/draffauf/31b1...

Chapters:
0:00 Intro
0:36 Coding overview
3:08 Code using hard-coded values
6:45 Randomize language
11:05 Randomize emoji
13:45 Randomize adjective
18:15 Review progress
19:00 What can we improve?
21:35 Create and use randomizer
24:00 Extract constant arrays
25:35 Extensibility: parameterize lists
26:45 Use default values for parameters
27:15 SKIP - Interruption
28:00 David returns!
28:25 Extract ItemFromList
32:00 Extract and parameterize Chooser
34:00 Alternative Choosers
35:45 Clean up
36:05 Add more data
36:35 Review and future improvements
38:30 Wrap up!

Social:
🌍 Website: https://restfulcoder.com/
💬 Discord:   / discord  
📷 Instagram:   / restfulcoder  
🐦Twitter:   / restfulcoder  
📱 Tiktok:   / restfulcoder