Array join
In this chapter you will learn:
Array join() method
The join()
method accepts the string separator as
the only argument and returns a string containing all items.
<!DOCTYPE html><!-- ja va 2 s . c o m-->
<html>
<head>
<title>Example</title>
<script type="text/javascript">
var colors = ["red", "green", "blue"];
document.writeln(colors.join(",")); //red,green,blue
document.writeln(colors.join("||")); //red||green||blue
</script>
</head>
<body>
</body>
</html>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
Home » Javascript Tutorial » Array