DEV Community

Discussion on: Today I Learned - maxlength

Collapse
 
michaeltintiuc profile image
Michael Tintiuc

Why not do value.slice(0, MAX_STR_LEN) instead? Seems to be best of 2 worlds. And of course implement server-side validation on top of that.

Collapse
 
dhkamp profile image
David Hölkeskamp

This could've definitely helped me too - it just didn't come to my mind!