- The join() method will join every array value with separated by a specified separator. , and returns the string.
- Comma (,) is the default separator.
Code:-
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Array join()</h1>
<h2>ar=[10,20,30]</h2>
<input type="button" onclick="ar_join();" value="join()">
<script>
function ar_join()
{
var ar = [10, 20, 30];
var next_ar = ar.join('#');
alert("Return : " + next_ar);
alert("Original : " + ar);
}
</script>
</body>
</html>
The join in JavaScript:- Geniusofstudent
Reviewed by Network security
on
July 11, 2019
Rating:
No comments: