- The toString() method converts an array into a Strings.
- The returned string will separate the elements in the array with commas.
Code:-
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <body>
- <h1>Array to String</h1>
- <h2>var ar=[10,20,30]</h2>
- <input type="button" onclick="ar_fun();" value="array tostring()">
- <script>
- function ar_fun()
- {
- var ar = [10, 20, 30];
- alert(ar.toString());
- }
- </script>
- </body>
- </html>
Array to strings in JavaScript :- Geniusofstudent
Reviewed by Network security
on
July 11, 2019
Rating:
No comments: