DEV Community

loading...

Discussion on: Two string methods every JavaScript developer should know.

Collapse
brandito profile image
brandito • Edited

.slice(), .substr() and .substring() can all achieve this but I agree completely that it should be done with the fixed indexes since its quite apparent the data is all in the same format given his example and glad that my first thought was apparently the most efficient!

edit: turns out substr is non-standard and substring should be used instead