This week's code snippet, Longest Palindromic Substring in Javascript, is brought to you by Subete and the Sample Programs repo.
const [, , input] = process.argv;
const getLongestPalindromic = (string) => {
if (!string) return;
let longestPal = '';
for (let i = 1; i < string.length; i++) {
for (let j = 0; j < string.length - i; j++) {
let possiblePal = string.substring(j, j + i + 1).toLowerCase();
if (
possiblePal === [...possiblePal].reverse().join('') &&
possiblePal.length > longestPal.length
)
longestPal = possiblePal;
}
}
return longestPal;
};
console.log(
getLongestPalindromic(input) ||
'Usage: please provide a string that contains at least one palindrome'
);Below you'll find an up-to-date list of articles by me on The Renegade Coder. For ease of browsing, emojis let you know the article category (i.e., blog: โ๏ธ, code: ๐ป, meta: ๐ญ, teach: ๐)
- ๐ Encouraging Attendance With Peer Instruction
- โ๏ธ Conspiracy Theory: All Pro Sports Are Rigged Now
- ๐ Reflecting on My Teaching Journey Heading into 2026
- ๐ I Hate That Student Feedback Is Now Reviewed by Machine Learning
- โ๏ธ Not All Code Completion Is Generative AI
- โ๏ธ AI Haters Stay Winning: What Itโs Like to Be Constantly Vindicated
- โ๏ธ Computer Science Career Advice in 2026? Your Guess Is as Good as Mine
- ๐ Why I Donโt Record My Lectures
- โ๏ธ Should You Use Git on Personal Projects No One Will Ever See?
- โ๏ธ The Era of Narks Is Upon Us
Also, here are some fun links you can use to support my work.
This document was automatically rendered on 2026-01-16 using SnakeMD.





