cw screenreader unfriendly

not many people know about this really cool javascript feature that i use a lot

function test(t) { return t + " :3" }
test`:3`
=> ":3 :3"

comments (single view)

lily discovers string interpolation:

string interpolation is this:

`something = ${something}`;

i didn’t do string interpolation, i did whatever that thing is (it’s how preact works)

you can return objects and stuff too not just strings

I know what it is, what I meant is you should have used it

no, it was an example. if you’re being pedantic i shouldn’t even write `${":3"} :3`, just ":3 :3", but for the purposes of that example i was using a function because That’s The JavaScript Feature In Question

you should have done return `${t} :3` because it does the same thing and is just as readable but takes up less space

who cares it literally does not matter for the example. the variable is literally called t in the example do you think i cared about readability just to show off cool features? not really, it’s still just as readable to write t + " :3"

See more replies
View all comments