It doesn't sound like you write much JavaScript :)
> I think there's a case to be made that there is a completely unnecessary "bloat" to Javascript
"Bloat in JS" is something of a trope, and I'm not really even sure what you mean by it here. Typically people mean "too many JS dependencies are often drawn in for web pages", but that's not really relevant. Maybe you mean syntax bloat (method calls instead of list comprehensions)? If so, you're not totally wrong, but it's also not really a big deal in my experience. If you're talking about runtime/performance, well... V8 tends to be faster than CPython in raw compute (excluding native modules) because Google has put so much work into optimizing it (not that that matters much for a SSG either)
> it ends up boiling down to "what handles text well and in an established and smooth way," and Javascript does not score high there
Whenever I need to process some nontrivial text, the first thing I do is open up a Chrome tab for the JS repl. I think the following it pretty smooth:
const csv = `
Name,Email,Phone Number,Address
Bob Smith,bob@example.com,123-456-7890,123 Fake Street
Mike Jones,mike@example.com,098-765-4321,321 Fake Avenue`
const lines = csv.trim().split('\n').map(line => line.split(','))
const [headings, ...data] = lines
const objs = data.map(datum => Object.fromEntries(
headings.map((heading, index) => [heading, datum[index]])))
console.log(objs)
// output:
[
{
"Name": "Bob Smith",
"Email": "bob@example.com",
"Phone Number": "123-456-7890",
"Address": "123 Fake Street"
},
{
"Name": "Mike Jones",
"Email": "mike@example.com",
"Phone Number": "098-765-4321",
"Address": "321 Fake Avenue"
}
]
Not to mention template-strings, which I use extensively in my own website:
const header = `
<h1>Welcome to ${pageTitle}</h1>
`
Of course it's all subjective and Python does have format strings and some slick dedicated syntaxes. But I don't think it's fair to say "JavaScript does not score high" when it comes to text-shuffling.