DEV Community

Cover image for How I Built a SEO-Optimized FLAMES Calculator using Vanilla JS
Abhijit Adhikari
Abhijit Adhikari

Posted on

How I Built a SEO-Optimized FLAMES Calculator using Vanilla JS

💘 Bringing 90s Nostalgia to the Web with Vanilla JS

Do you remember scribbling names in the back of your notebook?

If you grew up in the 90s (especially in India), you definitely played FLAMES. It was the original "relationship algorithm" before Tinder existed.

F = Friendship
L = Love
A = Affection
M = Marriage
E = Enemy
S = Sibling

You cross out common letters, count the leftovers, and bam—your destiny is revealed.

I decided to build this as a modern web app. But I didn't want it to be boring. I wanted it fast, beautiful, and SEO-optimized.

Here is how I built FlamesCalculators.co.in.


**

🛠️ Why I Chose Vanilla JavaScript``

**

In a world obsessed with React and Next.js, I chose plain old Vanilla JS. Why?

  1. Speed: The logic is simple string manipulation. Loading a massive library for this is overkill.
  2. Performance: The site loads instantly. 0ms latency.
  3. SEO: Google loves clean, semantic HTML that loads fast.

🧮 The Logic (The Code)

The algorithm is surprisingly fun to code. Here is the clean, stripped-down version of the logic:

*javascript
*

`
function calculateFlames(name1, name2) {
// 1. Clean up the names (remove spaces, make lowercase)
const n1 = name1.replace(/\s+/g, '').toLowerCase().split('');
const n2 = name2.replace(/\s+/g, '').toLowerCase().split('');

// 2. Cross out common letters
n1.forEach((char, index) => {
const matchIndex = n2.indexOf(char);
if (matchIndex !== -1) {
n1[index] = ''; // Mark as removed
n2[matchIndex] = '';
}
});

// 3. Count what is left
const count = [...n1, ...n2].filter(Boolean).length;

// 4. The Elimination Game
const options = ["Friendship", "Love", "Affection", "Marriage", "Enemy", "Sibling"];
let index = 0;
let currentOptions = [...options];

// Loop until one option remains
while (currentOptions.length > 1) {
index = (index + count - 1) % currentOptions.length;
currentOptions.splice(index, 1);
}

return currentOptions[0]; // Your Destiny!
}

`

Top comments (1)

Collapse
 
evanlausier profile image
Evan Lausier

Thats fun!