O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Tab-Separated String from an Array

var weekdays= ["Mon", "Tue", "Wed", "thur", "Fri"] var weekStr = weekdays.join("\t"); // weekStr = "Mon\tTue\tWed\tthur\tFri"

The .join(separator) method allows you to combine an array into a string. The optional separator argument specifies the character or string to place between each item in the newly created string.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required