We’ve talked here on the blog about arrays in JavaScript and how to work with them to create and manipulate the data in an array tasks are really simple but the language provides other means to further facilitate the life of programmers. JOIN and CONCAT methods are great examples of this, and we know a little more about them in sequence.

JOIN

This method is used when you want to join an array into a single string using a separator character, check out the example below:

<script language=”JavaScript” type=”text/javascript”>
var num = new Array (3);
num[0] = 10;
num[1] = 20;
num[2] = 30;
document.write (num.join(“/”));
</script>

What will be printed to the screen from the code shown in the example is “10/20/30”, this way you can create a single string with all the data separated by the character entered.

CONCAT

This method is used to join two or more arrays into one, as shown below:

<script language=”JavaScript” type=”text/javascript”>
var Text1= new Array (“1″, “2″, “3″);
var Text2 = new Array (“4″, “5″, “6″);

var uni = Texto1.concat(Texto2);
document.write (uni);
</script>

he result to be displayed on the screen will be “1,2,3,4,5,6”.

javascript

The practical use of each of these methods will vary according to the logic that will be applied, so well understand how they work can help solve a problem eminent.

Test this and other code in Javascript Scriptcase enjoy and also test the various features our tool to be releasing, do not waste time and download now the free version of our tool and enjoy.

By , The most efficient web development environment. Create your web solutions in a fast and innovative way, reducing the development time in up to 80%. Access http://scriptcase.net and learn more.

August 14, 2013

a

You might also like…

The importance of training in the use of software

Today we are going to reflect on the importance of training in the use of software that, when explo...

A sneak peek on scriptcase 9.4.027!

Come check out all the new details for scriptcase version 9.4.027 !! This week we launched our n...

8 tips for working from home

Hello, how are you? We hope you are well! We know that the moment is difficult and many people a...

You might also like…

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.