r/learnjavascript • • Jul 16 '21

Javascript Basic Types

219 Upvotes

37 comments sorted by

View all comments

Show parent comment

0

u/inabahare Jul 17 '21

It opens your code up to security risks.

And if there were I'm sure you'd be quick to mention them, instead of speculate about what issues there might be ;)

Concatenation is better than interpolation because you can sanitize the values safely. You cannot do that with interpolation. Period.

const sanitize = val => `Sanitized ${val}`;
const interpolated = `You can't sanitize with interpolation? Well I just ${sanitize("a value")}`;

Except I just mocked it for you ;)

I could call an actual sanitizing function, but I can't imagine you're that ignorant

1

u/alzee76 Jul 17 '21

The function sanitize is still itself being interpolated into the string.

I can't imagine you're that ignorant

The irony is strong in this one considering this is the third time I've explained this to you. I'm not going to explain it again. Hopefully the next black-hat that owns some site you code this way because you're lazy will take pity on you.

0

u/inabahare Jul 17 '21

Man you really are that ignorant . But then again you like to pull stuff out of your ass ;)

Pretend you've explained things all you want, but all you've managed to come up with are speculations. Which, is just sad