Home > Web Front-end > JS Tutorial > A brief discussion on String and Array_javascript techniques in javascript

A brief discussion on String and Array_javascript techniques in javascript

WBOY
Release: 2016-05-16 16:22:57
Original
1070 people have browsed it

To put it simply, string is a character (string)...
And array is an array... you can put numbers, characters, etc.!!!

Previous example:

Copy code The code is as follows:

var str = "liuzhanqi";
document.write(str["length"]);//Equivalent to str.l ength
var str = string.fromcharcode(72, 101, 108, 108, 111, 33);
document.write(str); //Each integer is encoded as unicode and concatenated into a string.
var str1 = "liu".localecompare("zhan");//Compare the current string and the parameter string according to the default comparison rules provided by this system
document.write(str1);//
var str2 = "liu".slice(1);//Extract a substring from the current string
document.writeln(str2);
document.writeln("se nki".split(' '));//Split the string with a delimiter and return an array.
document.write('liu'.fontcolor('red'));
document.write('liu'.fixed()); // Make the string appear as a fixed-width character
document.write('liu'.strike());//Add strikethrough to the string
document.write("senki".sub());//Displayed as subscript
document.write("senki".sup());//Displayed as superscript

charCodeAt(index) Returns the Unicode encoding of the character at the string index. The value is an integer between 0 and 65535. If the index exceeds the range, NaN is returned.

concat(str2) Concatenates the string str2 to the current string to form a new string.

anchor(anchar_name) creates an anchor point

link(url) Add hyperlink

charAt(index) Returns a character at the position specified by index in the string

Have you guys understood the String and Array in JavaScript? If you have any questions, please leave me a message and we can make progress together.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template