Home For Fiction – Blog

for thinking people

Patreon LogoPatreon

horoscope

How to Make a JavaScript “Horoscope” Generator

November 10, 2019

Relax, I haven’t gone crazy. If you thought someone like me suddenly started believing in horoscopes, you’re wrong. Yes, in this post I’ll show you how to make a JavaScript horoscope generator. But the post is about linguistics, programming, and maybe psychology; not astrology.

If anything, my goal making this JavaScript horoscope generator was to show how ridiculously easy it is to produce accurate-seeming phrases that appear to apply to everyone’s individual situation. Simple answers to complex questions, really.

There’s actually a bit of literary background in this, believe it or not. There is a scene in my book The Other Side of Dreams, where the protagonist makes fun of a Tarot card reader:

Indeed, Ahmed thought, he could tell Anna pretty much everything the woman had said, without using any cards. “You are coming up a difficult fork in the road of your life, considering your options. Part of you would like to be more daring, but you are aware of the importance of being cautious. You are inspired by strong feelings, and you will be rewarded in love thanks to your tenacity. Remember to be true to yourself, although you should also be diplomatic, especially considering matters related to business, money, or agreements.” There, it can’t get any easier than that.

And so, I decided to combine my background in languages and my interest in programming. This JavaScript horoscope generator was the result!

JavaScript horoscope generator
I promise you, this JavaScript horoscope generator will not tell your fortune – because there is no such thing. Parenthetically, the code you see on the image is part of the actual code used in the program.
(more…)