JavaScripts substring(): Eigenwillig, nützlich, total verwirrend
JavaScripts substring() wirkt harmlos. Sie tauscht Argumente und vergibt NaN – hasst selbst alte Hasen.
⚡ Key Takeaways
- substring() tauscht Argumente automatisch und vergibt NaN/Negative – praktisch, aber bugsichtbar machend.
- Slice() für Negativzahlen und Vorhersagbarkeit wählen; substring nur für Legacy-Toleranz.
- Immer Indizes prüfen; JS-Strings zerlegen UTF-8-Emojis ohne Vorsicht.
Worth sharing?
Get the best Developer Tools stories of the week in your inbox — no noise, no spam.
Originally reported by dev.to