JavaScript array of string objects
5.1.1 Array (Array) Object
<script>
// declare an array and assignment;
var arr = new Array("aa","bb","cc");
// output number of array elements;
document.write(arr.length+"<br>");
// reverse the order of elements in the array, and the reverse order;
document.write(arr.reverse()+"<br>");
// removes the first element in the array and returns the element;
document.write(arr.shift()+"<br>");
// remove the last element in the array and returns that element;
document.write(arr.pop()+"<br>");
</script>
5.1.2 String (String) objects
<script>
// Declare a string and assignment;
var str = "String";
// output length of the string;
document.write(str.length+"<br>");
// string of text fonts become crossed out;
document.write(str.strike()+"<br>");
// string of text becomes italic;
document.write(str.italics()+"<br>");
// string of text into a small font;
document.write(str.small()+"<br>");
// string of text into a large font;
document.write(str.big()+"<br>");
// string of text into a black font;
document.write(str.bold()+"<br>");
// string of blinking text fonts become;
document.write(str.blink()+"<br>");
// text string into a fixed pitch font, i.e. telegram;
document.write(str.fixed()+"<br>");
</script>
Common method String (String) object
anchor、link |
Create a bookmark link, which is equivalent <A name=...>, format String.anchor () |
Create a hyperlink, the equivalent of <A href=...>, format String.link (URL) |
|
big、small、italics、bold、blink、sup、sub、fontsize 、fontcolor |
Create a character display format corresponding to <BIG>, <B> HTML tags. |
toLowerCase、toUpperCase |
String case conversion |
indexOf、lastindexOf |
Returns the specified substring in the string left in the first occurrence of the right index position |
substring(start,end) |
Back to start from the start to the end of the sub-characters (not including the end character position) |
charAt |
Returns a substring of a string specified |