concat and nunll check in typescript 1

concat and nunll check in typescript

['a', 'b', void 0, null, 6].join(''); // 'ab6'

Here is what the above code is Doing:
1. The first argument to join() is the separator.
2. The separator is inserted between the elements of the array.
3. If the separator is undefined or null, then the empty string is used.
4. If the separator is an empty string, then the elements are concatenated with no separator.
5. If the separator is a number, then it is converted to a string.
6. If the separator is an object, then it is converted to a string.
7. If the separator is a boolean, then it is converted to a string.
8. If the separator is a function, then it is invoked for each element of the array.
9. If the separator is a regular expression, then it is used to split the array.

Similar Posts