function
funMake() {
// length
var
ara = [1, 2, 3, 4, 5];
document.write(ara.length +
'<br />'
);
//This is a first element of the array
document.write(ara[0] +
//This is a last element of the array
document.write(ara[ara.length-1] +
// split()
str0 =
'1, 2, 3, 4, 5'
;
str1 =
'I work by a software developer in this office'
ara = str0.split(
', '
for
(
i=0; i<ara.length; i++) {
document.write(ara[i] +
' '
}
document.write(
ara = str1.split(
' '
// join()
ara = [
];
str = ara.join();
document.write(str +
// toString()
str = ara.toString();
// push()
ara = [1, 2, 3];
ara.push(4, 5);
// pop()
ara.pop();
// unshift()
ara.unshift(100, 200);
// shift()
ara.shift();
// reverse()
ara.reverse();
// slice()
ara0 = [1, 2, 3, 4, 5];
i=0; i<ara0.length; i++) {
document.write(ara0[i] +
ara1 = ara0.slice(0, 3);
i=0; i<ara1.length; i++) {
document.write(ara1[i] +
// splice()
ara = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
ara.splice(0, 5);
ara.splice(0, 5, 1, 1, 1, 1, 1);
// sort()
ara = [1, 3, 45, 17, 5, 28, 94, 5, 18, 77, 5];
i = 0; i < ara.length; i++) {
ara.sort();
ara.sort(
(a, b) {
return
(a-b);
});
<!DOCTYPE html>
<
html
>
head
meta
charset
=
"utf-8"
/>
title
>New Page</
script
src
"js/script.js"
></
</
body
funMake();