Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
  <title>townie generator</title>
</head>
<body>

  <h2>random townie generator</h2>
  <div>
    <button onClick="getTownie()">generate</button>
  </div>
  <div>
    </br>
    <div id="nameOutput"></div>
    <div id="ageOutput"></div>
    <div id="pronounsOutput"></div>
    <div id="gpOutput"></div>
    <div id="birthdayOutput"></div>
    <div id="hobbyOutput"></div>
    <div id="traitOutput"></div>
    <div id="charmOutput"></div>
    <div id="giftOutput"></div>
    <div id="locationOutput"></div>
    </body>


              
            
!

CSS

              
                
              
            
!

JS

              
                
function getTownie(){

  var name = ["Acacia", "Anise", "Apple", "Aspen", "Aurelia / Aurelis", "Autumn", "Avocado", "Basil", "Birch", "Bliss", "Blueberry", "Bluejay", "Botan", "Bubble", "Canary", "Carnation", "Carrot", "Chamomile", "Chanterelle", "Cherry", "Clementine", "Clover", "Coco", "Coffeebean", "Cosmos", "Daffodil", "Daisy", "Dandelion", "Doppio", "Elm", "Enoki", "Feather", "Fern", "Fig", "Flor", "Ginger", "Gourd", "Harmony", "Heather", "Hibiscus", "Holly", "Honey", "Huckleberry", "Iris", "Ivy", "Jasmine", "Java", "Junebug", "Juniper", "Kale", "Kuutti", "Laurel", "Daisy", "Lemon", "Lief", "Lily", "Lotus", "​LΓΊz", "Magnolia", "Maple", "Marguerite", "Marigold", "Matcha", "Mint / Minty", "Morel", "Mushroom", "Nala", "Oak", "Onion", "Orange", "Oyster", "Parsley", "Peach", "Peony", "Pepper", "Pine", "Plum", "Pomo", "Poppy", "Potato", "Pumpkin", "Raspberry", "Robin", "Rose", "Rowan", "Sage", "Spring", "Spruce", "Summer", "Sunny", "Sycamore", "Thistle", "Thyme", "Tomato", "Truffle", "Tulip", "Turnip", "Willow", "Winter", "Wisteria", "Aestral", "Aldebaran", "Amber", "Amethyst", "Andes", "Antares", "Argent", "Auburn", "Aura / Aurora", "Azul", "Bismuth", "Blanche", "Blaze", "Blondie", "Bolt", "Brooke", "Canyon", "Caster", "Cave", "Celeste", "Ciel", "Citrine", "Cliff", "Cloud", "Coral", "Craig", "Cressida", "Crystal", "Cyan", "Cygnus", "Diamond", "Ebony", "Emerald", "Etoile", "Everest", "Frost", "Gail", "Garnet", "Gold", "Gravel", "Hollow", "Hunter", "Iceberg", "Indigo", "Ivory", "Jasper", "Lapis / Lazuli", "Lava", "Leon", "Lilac", "Lionseye", "Luna / Lune", "Magnus", "Marina", "Misty", "Mojave", "Moonstone", "Mountain", "Neon", "Nimbus", "Noir", "Obsidian", "Ocean", "Opal", "Orion", "Paradox", "Pearl", "Pebble", "Peridot", "Phantom", "Pollux", "Pyrope", "Quarry", "Quartz", "Rain / Raine", "Redd", "Reef", "River", "Roja", "Ruby", "Rusty", "Saga", "Sapphire", "Scarlet", "Serenity", "Sierra", "Silver", "Skye", "Snow", "Sparky", "Squall", "Star", "Terra", "Topaz", "Tornado", "Verde", "Violet", "Wolke", "Yosemite", "Zircon", "Ace", "Affogato", "Amity", "Arcade", "Arrow", "Bean", "Bernie / Bennie", "Bingus", "Bite", "Blorbo", "Bolita", "Boo!", "Box", "Broom", "Bug", "Bunny", "Buster", "Buttercup", "Candelabra", "Candy", "Carafe", "Chase", "Clown", "Clown", "Cory", "Cream", "Cup", "Daydream", "Doily", "Donut", "Dove", "Dulce", "Duster", "Egg", "Felix", "Fork", "Frappe", "Glove", "Granola", "Greeble", "Honk", "Ianto", "Jewel", "Ketchup", "Kettle", "Kiki / Keke", "Kitty", "Knife", "Lamp", "Latte", "Lime", "Loaf", "Melody", "Milk", "Mixer", "Moss", "Muffin", "Mustard", "Noodle", "Nuggie", "Nurny", "Pancake", "Peanut", "Pippy", "Potoo", "Puppy", "Ramen", "Reese", "Retro", "Rogue", "Scrunchie", "Shark", "Shrimp", "Skelly", "Snail", "Sniff", "Sock", "Soup", "Spatula", "Spicy", "Splimbus", "Spoon", "Sprinkle", "Sugar", "Tadpole", "Tamago", "Teacup", "Toby", "Treasure", "Tummy", "Udon", "Valentine", "Waffle", "Wasabi", "Whisper", "Wilde", "Wish-Bone", "Worm", "Wrench", "Yogurt"];
  var age = ["Baby", "Child", "Teenager", "Young Adult", "Adult", "Elder", "Ancient"];
  var pronouns = ["They/Them", "She/Her", "He/Him", "She/They", "He/They", "It/Its", "Any"];
  var gp = ["Feminine", "Masculine", "Androgynous", "Other"];
  var bdayMonth = ["Spring", "Summer", "Fall", "Winter"];
  var hobby = ["Animal training", "Ant keeping", "Archaeology/Fossil hunting", "Astronomy", "Baking/Cooking", "Baseball", "Beekeeping", "Beer brewing", "Biology", "Bird Watching", "Blacksmithing", "Board games", "Breakdancing", "Bug collecting", "Cheesemaking", "Chess", "Clothes Making", "Coin collecting", "Comic books", "Community Radio", "Cornhole", "Cosplaying", "Cross Stitch", "Crossword puzzles", "Cryptography", "Dance", "Drama (Acting)", "Drawing", "Engineering", "Fashion", "Filmmaking", "Fishing", "Football", "Freestyle rapping", "Gardening", "Genealogy", "Geology", "Ghost hunting", "Glass Blowing", "Gunsmithing", "Hiking", "Horticulture (Flowers)", "Houseplants", "Interior decorating", "Jigsaw puzzles", "Juggling", "Karaoke", "Knitting", "Lacrosse", "Leather crafting", "Martial arts (Judo, Karate, etc)", "Meditation", "Metal detecting/beach combing", "Model aircraft", "Model trains", "Music (Banjo)", "Music (Drums)", "Music (Guitar)", "Oil painting", "Origami", "People Watching", "Photography", "Ping-pong", "Poetry", "Pogs", "Pottery", "Pranks/Practical jokes", "Puppetry", "Reading (Fantasy)", "Reading (History)", "Reading (Mysteries)", "Reading (other)", "Rugby", "Running", "Scrapbooking", "Sculpting", "Singing", "Skiing", "Sledding", "Soap making", "Soccer", "Spellcrafting/Witchcraft", "Stamp collecting", "Stand Up comedy", "Sunbathing", "Surfing", "Swimming/Diving", "Tarot reading", "Thrifting", "Upcycling", "Vinyl records", "Volleyball", "Wine tasting", "Wood working", "Writing (Fiction)", "Writing (Journaling)", "Writing (Local history)", "Yo-yo", "Yoga", "Roll twice"];
  var trait = ["Adorable", "Adventurous", "Agile", "Aloof", "Ambitious", "Anxious", "Arrogant", "Artistic", "Athletic", "Bitter", "Bold", "Book Smart", "Brooding", "Buff", "Careless", "Caring", "Cautious", "Charming", "Chatty", "Competitive", "Confident", "Crafty", "Creative", "Curious", "Daring", "Deceptive", "Determined", "Devoted", "Disabled", "Disarming", "Eccentric", "Elegant", "Excited", "Faithful", "Fashionable", "Foodie", "Frightened", "Frugal", "Generous", "Gentle", "Glamorous", "Grumpy", "Guilty", "Hard-working", "Healthy", "Hilarious", "Homebody", "Honest", "Hot-Headed", "Impulsive", "Independent", "Irritated", "Jolly", "Kind", "Lavish", "Lazy", "Loud", "Loyal", "Mischievous", "Mysterious", "Naive", "Needy", "Nerdy", "Nurturing", "Observant", "Optimistic", "Organized", "Outdoorsy", "Passionate", "Peppy", "Pessimistic", "Powerful", "Prepared", "Protective", "Quiet", "Rebellious", "Relaxed", "Romantic", "Scary", "Secretive", "Selfish", "Selfless", "Serious", "Sharp", "Shy", "Skeptic", "Sleepy", "Snarky", "Soft Spoken", "Sporty", "Street Smart", "Studios", "Superstitious", "Tenacious", "Timid", "Troubled", "Unruly", "Well-spoken", "Wild", "Wise"];
  var charm = ["Always carrying a book", "Always carrying drink/food", "Always has pet with them", "Always in Uniform", "Always Smirking", "Animal Ears/Horns Accessory", "Apron", "Baby Face", "Bandages", "Bandana", "Barefoot", "Beauty Mark", "Belts", "Big Doll Eyes", "Big Hat", "Big Shoes", "Big Weapon/Tool", "Billowing Cloak", "Birthmark", "Bodysuit", "Boots", "Bracelet", "Brooch", "Burn Scar", "Cane", "Carries a Doll/Plush", "Choker", "Cleavage (Gender Neutral)", "Corset/Binder", "Crown", "Cute Lil Fang", "Dance Shoes", "Deadpan Expression", "Disheveled", "Dramatic Eyebrows", "Dressed for Success", "Earrings", "Eye(s) Covered", "Eyebags", "Eyepatch", "Face is obscured", "Face Paint", "Family Insignia", "Fanny Pack", "Flowers", "Freckles", "Frills/Ruffles", "Gap in front teeth", "Glasses", "Glitter", "Gloves", "Goggles", "Hair Antenna", "Headband", "Heterochromia", "High Collar", "Large Bag/Backpack", "Long Coat", "Long Eyelashes", "Makeup", "Mask", "Medal", "Midriff", "Mischievous Grin", "Missing Limb", "Mobility Device", "Monocle", "Muscular", "Narrow Frame", "Oversized Clothes", "Parasol/Umbrella", "Pendant", "Permanently Looks Grumpy", "Piercing(s)", "Pocketwatch", "Provocative Clothing", "Ribbon", "Ring", "Rosy Cheeks", "Scar(s)", "Scarf/Muffler", "Short", "Showing Some Skin", "Sunglasses", "Suspenders", "Tall", "Tattered Cloak", "Tattoo(s)", "Tie/Bow Tie", "Tight-fitting Clothes", "Tiny Bag", "Tiny Hat", "TOO MANY ACCESSORIES", "Toothpick/Lollipop", "Traditional Clothing", "Utility Belt", "Veil", "Wide Frame", "Wrinkles", "Zippers"];
  var giftResource = ["🌷 Flowers", "πŸ„ Mushrooms", "🌿 Herbs", "🌾 Grains", "🍎 Fruit", "πŸ₯• Vegetables", "πŸ“ Berries", "🐟 Fish", "🌳 Wood", "🧱 Ore", "πŸ₯š Eggs", "πŸ’Ž Gems", "πŸ₯› Milk", "🧡 Textiles/Wool", "🍯 Honey", "🐞 Bugs", "🦴 Fossils", "πŸ’§ Spring Water", "πŸ—‘ Rubbish", "πŸ’­ Ideas/Inspiration"];
  var giftItem = ["πŸ‘š Clothes", "πŸ‘ž Shoes", "πŸ’Š Medicine", "πŸ’ Jewelry", "πŸ“š Books", "⛏ Tools", "πŸ–Ό Art", "πŸͺ‘ Furniture", "🧸 Toys", "🍺 Drinks", "πŸ” Food", "πŸͺ” Fragrances", "πŸ’ Floral Arrangements", "🧺 Home Goods"];
  var location = ["Abandoned House", "Abandoned workshop", "Alleyway", "An ancient shrine", "An underground bunker", "At the bottom of the well", "Bar at happy hour", "Bear cave", "Behind the waterfall", "Berry bush patch", "Boardwalk", "Bottom of the lake", "Burnt out tree that got hit by lightning", "Campgrounds", "Cave with glowing mushrooms", "Cave with old", "Cliff face", "Community Center", "Community Garden", "Coral reef", "Crystal cave", "Dense Forest", "Doctor's Office", "Fairy Circle", "Farm", "Field of wildflowers", "Field with crop circles", "Fishing pond", "Forest Clearing", "Fountain", "Gentle brook", "Giant tree in the middle of the forest", "Graveyard", "Harbor", "Haunted house", "Hidden from view", "Hiking trail", "Hill overlooking the town", "Hunting lodge", "In the middle of the ocean", "Inn", "Inside the old barn", "Library", "Local Shop", "Log cabin", "Market", "Metro station", "Monument to the founder of Iron Valley", "Museum", "Old carousel in the woods", "Old sunk ship", "Overgrown Farm", "Overgrown vehicle in the middle of an open field", "Park", "Patch of marshland", "Peaceful lake", "Playground", "Plaza", "Pond said to have healing properties", "Post Office", "Quarry", "Quiet dock at midnight", "Ranger station", "Red X on the side of a cavern wall", "Restaurant", "River rapids", "Roadside stand", "Rock cliffs overlooking the ocean", "Rock climbing spot", "Rolling hills of green grass", "Sandy beach", "School", "Secret mine entrance", "Secret treehouse", "Small island", "Snowy summit", "So deep in the forest you might as well be lost", "Stone circle where people gather at night", "The base of the mountain", "The bottom of the caves", "The fairgrounds", "The local temple", "The old iron mine", "The one house nobody goes in", "The road out of Iron Valley", "The top of the tallest tree", "\"The Witch's Hut\"", "Top of the mountain", "Town Hall", "Townie's House", "Townie's pool", "Tree grove", "Tree with a couple's name carved on it", "Tree with moss growing on the wrong side", "Under the bridge", "Underwater cave", "Valley of shimmering moonflowers", "Walking Trail", "Where the fog is so thick you can't see in front of you", "Wishing well"];



  var nameNum = Math.floor(Math.random() * name.length);
  var ageNum = Math.floor(Math.random() * age.length);
  var pronounsNum = Math.floor(Math.random() * pronouns.length);
  var gpNum = Math.floor(Math.random() * gp.length);
  var bdMonthNum = Math.floor(Math.random() * bdayMonth.length);
  var bdayNum = (Math.floor(Math.random() * 25) + 1);
  var hobbyNum = Math.floor(Math.random() * hobby.length);
  var traitNum = Math.floor(Math.random() * trait.length);
  var traitNum2 = Math.floor(Math.random() * trait.length);
  var giftResourceNum = Math.floor(Math.random() * giftResource.length);
  var giftItemNum = Math.floor(Math.random() * giftItem.length);
  var locationNum = Math.floor(Math.random() * location.length);


  nameOutput.textContent = "Name: " + name[nameNum];
  ageOutput.textContent = "Age: " + age[ageNum];
  pronounsOutput.textContent = "Pronouns: " + pronouns[pronounsNum];
  gpOutput.textContent = "Gender Presentation: " + gp[gpNum];
  birthdayOutput.textContent = "Birthday: " + bdayMonth[bdMonthNum] + " " + bdayNum;
  hobbyOutput.textContent = "Hobby: " + hobby[hobbyNum];
  traitOutput.textContent = "Traits: " + trait[traitNum] + " & " + trait[traitNum2];
  giftOutput.textContent = "Favorite Gifts: " + giftResource[giftResourceNum] + " & " + giftItem[giftItemNum];
  locationOutput.textContent = "Special Location: " + location[locationNum];

}
              
            
!
999px

Console