Array to string in javascript

     The toString() method returns a string representing the specified array and its elements. The Array object overrides the toString method of Object. For Array objects, the toString method joins the array and returns one string containing each array element separated by commas. For example, the following code creates an array and uses toString to convert the array to a string.

Syntax

   Array.toString();

Example

   var ar=[10,20,30];
   alert(ar.toString());


Example Program:- (Editor)


Editor is Loading...

Advertisement

0 nhận xét:

Đăng nhận xét