Productivity Quote by Douglas Crockford
““suppress empty strings in the output array when the separator is a regular expression: var f = '|a|b|c|'.split(/\|/); // f is ['a', 'b', 'c'] on some systems, and // f is ['', 'a', 'b', 'c', ''] on others string.substring(start, end ) The substring method is the same as the slice method except that it doesn’t handle the adjustment for negative parameters. There is no reason to use the substring method. Use slice instead. string.toLocaleLowerCase( ) The toLocaleLowerCase method produces a new string that is made by converting this string to lowercase using the rules for the locale. This is primarily for the benefit of Turkish because in that language 'I’ converts to 1””
About This Quote
The quote discusses best practices for string handling in programming, emphasizing consistent splitting, preferring slice over substring, and locale-aware case conversion.
In simple terms: Use reliable string methods and locale-aware case conversion.
Prefer slice, handle empty splits, respect locale.
Themes
Mood
Type
When to use this quote
- data parsing
- internationalization
- code portability
Key Concepts
Questions to Reflect On
- How do you ensure consistent split results?
- When should you choose slice over substring?
Neglecting locale can cause bugs in Turkish text.