How JavaScript Array Methods Helped Samay Raina Create “India’s Got Latent”
Learn java-script array functions from Samay Raina story of creating India's got latent.
Table of contents
- How It All Began
- 0. Samay needs an a place to store contestants and their talents.
- 1. push() – Adding Contestants to the Show
- 2. pop() – Eliminating the boring Contestant
- 3. unshift() – Adding the Judges Panel before at the front chairs
- 4. shift() – One Judge Gets Busy
- 5. map() – Giving the Contestants Nicknames
- 6. filter() – Removing the Contestants Who Were Too Normal
- 7. find() – The Most Unexpected Talent
- 8. some() – Checking if There’s a True Talent
- 9. reduce() – Calculating the Final Score
- 10. sort() – Announcing the Winner
- Thanks for watching
One day, Samay Raina sat in his room, sipping chai, wondering—"What if there was a talent show where people showcased completely random skills, like solving a Rubik's cube blindfolded while rapping?"
And just like that, India’s Got Latent was born—a YouTube show where contestants showcase their weirdest talents while being judged by Samay and his panel of hilarious guests. But little did everyone know, behind the scenes, JavaScript array methods were working their magic to keep the show running!
How It All Began
0. Samay needs an a place to store contestants and their talents.
He created an Array and started storing Contestant names with their talents.
let contestants = ["Kesav - Sanskrit poems", "Suryansh - Act like Salman Khan from Bigboss"];
1. push()
– Adding Contestants to the Show
Samay needed contestants. He opened Google Forms, announced the show, and boom—people started signing up. So he uses push function and added contestants.
let contestants = ["Kesav - Sanskrit poems", "Suryansh - Act like Salman Khan from Bigboss"];
contestants.push("Kushal - Blind Comedian", "Ram - Reads fast", "Ankit - Beatboxes like a printer and he has hairfall issue");
console.log(contestants);
/* [
"Kesav - Sanskrit poems",
"Suryansh - Act like Salman khan from Bigboss",
"Kushal - Blind Comedian",
"Ram - Reads fast",
"Ankit - Beatboxes like a printer and he has hairfall issue"
] */
2. pop()
– Eliminating the boring Contestant
The last contestant wants to share his personal problems on the show and Samay needs to remove him.
So he uses pop function from the last.
contestants.pop();
console.log(contestants);
// [
// "Kesav - Sanskrit poems",
// "Suryansh - Act like Salman Khan from Bigboss",
// "Kushal - Blind Comedian",
// "Ram - Reads fast"
// ]
Samay: "Bro came for fame, left with shame."
3. unshift()
– Adding the Judges Panel before at the front chairs
A talent show needs judges, so Samay called his funniest friends.
But he wants to sit at the last seat after all the judges so he uses unshift function to add all the judges before him.
let judges = ["Samay Raina"];
judges.unshift("Tanmay Bhat", "Deepak Kalal", "Maheep ji", "Urfi Javed");
console.log(judges);
// ["Tanmay Bhat", "Deepak Kalal", "Maheep ji", "Urfi Javed", "Samay Raina"]
Samay: "This panel looks like a comedy podcast that got lost and ended up on a talent show."
4. shift()
– One Judge Gets Busy
Tanmay suddenly remembers to go for a gym and reduce his weight.
judges.shift();
console.log(judges);
// ["Deepak Kalal", "Maheep ji", "Urfi Javed", "Samay Raina"]
Samay: "Tanmay bhai, please come back! I need your back always!
5. map()
– Giving the Contestants Nicknames
Samay decided every contestant needed a Latent title. So he used map function and split function to retrieve the first word from all the contestant strings by separating them on ‘-’ and add “ the Latent Legend” ahead of all the names.
let contestantNicknames = contestants.map(contestant => contestant.split(" - ")[0] + " the Latent Legend");
console.log(contestantNicknames);
// ["Keshav the Latent Legend", "Suryansh the Latent Legend", "Kushal the Latent Legend", "Ram the Latent Legend" ]
Samay: "Bro, now they sound like WWE wrestlers!
6. filter()
– Removing the Contestants Who Were Too Normal
Samay realized some contestants were too normal and had Reading fast as a talent. So he used filter function to remove anyone with Reads fast talent. He checked if the contestant has Reads fast as their talent using includes function
let uniqueTalents = contestants.filter(contestant => !contestant.includes("Reads fast"));
console.log(uniqueTalents);
// [
// "Kesav - Sanskrit poems",
// "Suryansh - Act like Salman Khan from Bigboss",
// "Kushal - Blind Comedian",
// ]
Samay: "Sorry Ram, Reading fast isn’t a talent. That’s just me during winter."
7. find()
– The Most Unexpected Talent
The judges wanted to find the most unique talent with disability. So they used find function to find any string that had Blind in it.
let crazyTalent = contestants.find(contestant => contestant.includes("Blind"));
console.log(crazyTalent);
// "Kushal - Blind Comedian"
Samay: "Kushal, you see everyone is standing on their feet?! Ohh sorry you cant see!"
8. some()
– Checking if There’s a True Talent
Samay wondered—"Do we have at least one contestant who is truly talented ?"
let hasWeirdTalent = contestants.some(contestant => contestant.includes("Salman") || contestant.includes("Poem"));
console.log(hasWeirdTalent);
// true
Samay: "Yes, we have found our crazy people. This show is going viral
9. reduce()
– Calculating the Final Score
Each judge gave a score, and the contestant also rated themselves. So Samay used reduce function to calculate the average of all the scores.
Note - This time Judges gave all the contestant same scores.
let contestantScore = [7, 8, 9, 8, 7]; // Scores from 4 judges + self-rating
let averageScore = contestantScore.reduce((total, score) => total + score, 0) / contestantScore.length;
console.log(averageScore);
// 7.8
Samay: "Bro, imagine getting roasted by Urfi, then giving yourself a 10.
10. sort()
– Announcing the Winner
After all rounds, the final scores were sorted in descending order using sort function, and the winner was declared.
let finalScores = [
{ name: "Keshav", score: 7.8 },
{ name: "Suryansh", score: 6.8 },
{ name: "Kushal", score: 7.0 }
];
finalScores.sort((a, b) => b.score - a.score);
console.log(finalScores);
/*
[
{ name: "Keshav", score: 7.8 },
{ name: "Kushal", score: 7.0 },
{ name: "Suryansh", score: 6.8 }
]
*/
Samay: "And the winner is... Keshav JHAA, Make some noise for Kehsav Jhaa”
Thanks to JavaScript array methods, Samay Raina successfully created the funniest talent show on YouTube—where the strangest skills shine.
And that, my friends, is how India’s Got Latent became legendary. 😎♟️🎤