There are two different ways to create a new object:
1. Defining and creating an instance of an object
2. Use a function to define an object, and then create a new object instance
JavaScript is based on prototype, not class-based.
<script type= "Text/javascript" >
//join (): All elements of an array are put into a string. Custom delimiter.
var aa=[1,23,4,56];
var bb=aa.join ();
var cc=aa.join (' | ');
document.write (bb+ "<br/>");
document.write (cc+ "<br/>");
//concat (): Joins two or more arrays (which make up a new array) and returns the result.
var bb=[1,2,3],cc=[4,5,6],dd=[7,8,9];
document.write (Bb.concat (cc) + "<br/>");
document.write (Bb.concat (CC,DD) + "<br/>");
//reverse (): Reverses the order of the elements in the array.
document.write (' original order: ' +aa+ ' <br/> ')
document.write (' Upside Down Order: ' +aa.reverse () + ' <br/> ');
//sort (): Sorted by ASCII.
var ee=[1,23,53,6363,11,242,22,556];
var ff=[' Ghe ', ' eff ', ' abc '];
document.write ("ASCII English Sort:" +ff.sort () + "<br/>");
document.write ("ASCII digit sort:" +ee.sort () + "<br/>");
//From small to large
document.write ("Digital sorting from small to large:" +ee.sort (PAIXU1) + "<br/>");
function Paixu1 (A, b) {
Return a-b;//If a-b>0 returns a a-b<0 returns B
}
//from large to small if b-a>0 returns b b-a<0 returns a
document.write ("Numeric sort from large to small:" +ee.sort (function (A, b) {return b-a}));
</script>
push () adds one or more elements to the end of the array and returns the new length.
concat () joins two or more arrays and returns the result.
join () places all elements of an array into a string. element is delimited by the specified delimiter.
pop () deletes and returns the last element of the array
push () adds one or more elements to the end of the array and returns the new length.
reverse () reverses the order of the elements in the array.
shift () deletes and returns the first element of the array
Slice () returns the selected element from an existing array
sort () sorts the elements of an array
Splice () deletes the element and adds a new element to the array.
tosource () returns the source code of the object.
toString () converts the array to a string and returns the result.
tolocalestring () converts the array to a local array and returns the result.
unshift () adds one or more elements to the beginning of the array and returns the new length.
valueOf () returns the original value of the array object
Some common methods for arrays