lily — 11/20/2023, 7:27:46 PM

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"
♥ 4 ↩ 0 💬 9 comments

comments

oren:

lily discovers string interpolation:

11/20/2023, 7:39:38 PM
lily:

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

11/20/2023, 8:02:15 PM
oren:

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

11/20/2023, 8:02:55 PM
lily:

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

11/20/2023, 8:07:05 PM
oren:

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

11/20/2023, 8:08:42 PM
lily:

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"

11/20/2023, 8:10:40 PM
grippins:

programmer beef

11/20/2023, 8:51:42 PM
asfsdgdfd:

fr

11/20/2023, 9:39:17 PM
lily:

i don’t even get it like there was no need for him to say that, it doesn’t matter

11/20/2023, 10:30:38 PM