<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>JavaScript_Array_Methods.html</title>
</head>
<body>
<script>
var arr = [30, 20, 10, 50, 40];
// join()
var varJoin = arr.join();
document.write(varJoin + "<br />");
varJoin = arr.join(";");
document.write(varJoin + "<br />");
// sort()
var varSort = arr.sort();
document.write(varSort + "<br />"); // 오름차순 정렬
// reverse()
var varReverse = arr.sort().reverse(); // 내림차순 정렬
document.write(varReverse + "<br />");
// concat()
var colors = ["red", "green", "blue"];
var otherColors = ["black", "yellow"];
var moreColors = colors.concat(otherColors);
document.write(moreColors + "<br />");
// slice()
var rgbColors = moreColors.slice(0, 2); // 0, 1
document.write(rgbColors + "<br />");
rgbColors = moreColors.slice(1, 4); // start <= slice < end
document.write(rgbColors + "<br />"); // g, b, b
</script>
</body>
</html>