Friday, October 17, 2014

Write A program to use ofArray Function in javascript.


Write A program to use ofArray Function in javascript.
Code : arrayf.html

<!-- Array Functions -->
<html>
<head>

<style type="text/css">
.body
{
font-family:Maiandra GD;
color:blue;
font-size:30px;
}
</style>
</head>

<body class="body">

<script type="text/javascript">
var a=["BUS","STAR","TREE","MASH"];
var b=["RING","these are topologes"];
var c=a.concat(b);
document.write("<br>concat() : to mearge two or more array in to single array. :: "+c);
document.write("<br>join() : to join array element into string. Element will be separated by separator. :: ");
document.write(a.join("/"));
document.write("<br>pop() : takes last ele-ment of an array. :: ");
a.pop();
document.write(a);
document.write("<br>push() : Add one or more element onto the end of an array. :: ");
a.push("ABC","DEF");
document.write(a);
document.write("<br>shift() : takes the first element of an array. :: ");
a.shift();
document.write(a);
/*document.write("<br>unshift() : Add one or more element to the beginning of an array. :: ");
a.unshift("123","345");
document.write(a);
document.write("<br>reverse() : Print array element in reverse. :: ");
document.write(a.reverse());
document.write("<br>sort() : sort an array element alohabetically by default. :: ");
document.write(a.sort());

document.write("<br>lengh() : returns the lengh of an array. :: ");
document.write(a.length); */
</script>
</body>
</html>

No comments: