CodesJava

Easy learning with example program codes

JavaScript Array join() method

The JavaScript array join() method is used to join the elements of an array as a string.

Syntax:

array.join (separator)

Parameters:
separator: It represent the separator which will be used between array elements and it is optional parameter.

Returns:
A string which will contains the array elements with specified separator.

Example:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>  
var a = ["GOLD","SILVER","DIAMOND","RUBY","PLATINUM"]	 
var result=a.join()
document.writeln(result);  
</script>  
</body>
</html>

Output:

GOLD,SILVER,DIAMOND,RUBY,PLATINUM
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status