0% found this document useful (0 votes)
26 views

Array

The document defines several JavaScript array methods including concat, reverse, push, pop, shift, unshift, slice, and join. It creates arrays, concatenates arrays, reverses and sorts arrays, adds and removes elements from arrays, and joins array elements into a string.

Uploaded by

Kanika Shahi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Array

The document defines several JavaScript array methods including concat, reverse, push, pop, shift, unshift, slice, and join. It creates arrays, concatenates arrays, reverses and sorts arrays, adds and removes elements from arrays, and joins array elements into a string.

Uploaded by

Kanika Shahi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

doctype html>
<html>
<head>
<meta charset="utf-8">
<title>array</title>
</head>

<body>
<script>
const courses = ["HTML", "CSS", "Javascript"];
document.write(courses[0])
document.write(courses[1])
document.write(courses[2])

var x=courses.length;
document.write("<br>The length of the Array"+x);

for(var i=0;i<x;i++)
document.write(courses[i]+"<br>");

var arr1=["C","C++","Python"];
var arr2=["Java","JavaScript","Android"];
var result=arr1.concat(arr2);
document.writeln(result);

document.write("<br><br>");

var arr=["AngulaJS","Node.js","JQuery"];
var rev=arr.reverse();
document.writeln(rev);

document.write("<br><br>");

arr.push("PHP");
document.write(arr);

document.write("<br><br>");

arr.pop();

document.write(arr);

document.write("<br><br>");

arr.shift();
document.write(arr);

document.write("<br><br>");

arr.unshift("Bootstrap");
document.write(arr);

document.write("<br><br>");
var result=arr.slice(1,3);
document.writeln(result);

document.write("<br><br>");
var result=arr.join('/');
document.write(result);

</script>
</body>
</html>

You might also like