For example let's say we want to convert an array of zip codes into a comma separated list.
<script> var zipCodes = [90210, 90211, 90212, 90213, 90214]; </script>
If we just call the zipCodes.join() method we will get a string of comma separated list
If we want to separate the zip codes with a dash we can specify the separator like the following zipCodes.join("-")
Well you get the idea, if you want to separate your elements with a space you would type zipCodes.join(" ")
No comments:
Post a Comment