The application of the several functions:
<script>//global variable cannot be deleted, and global attribute can delete var a=123;function aa () {B=321;delete B;} AA ();d elete A;//console.log (a), var str= "Wo ai Sanmei";/* constructor mode */function strobj (argument) {this.concats=function ( Argument) {Arguments[0].concat (arguments[1]); Console.log (Arguments[1].concat (Arguments[0));}; This.indexofs=function (argument) {Console.log (Arguments[0].indexof ("O"));}; This.lastindexofs=function (argument) {Console.log (Arguments[0].indexof ("O"));}; This.trims=function (argument) {Console.log (Arguments[0].trim (). length);}; This.touppers=function (argument) {Console.log (Arguments[0].touppercase ());}; This.tolowers=function (argument) {Console.log (Arguments[0].tolowercase ());};} Strobj.prototype.slices = function (argument) {Console.log (Arguments[0].slice (0,5));}; Strobj.prototype.substrs = function (first_argument) {Console.log (Arguments[0].substr (0,4));}; Strobj.prototype.substrings = function (first_argument) {Console.log (arguments[0].substring (0,6));};/ *string*///charat () charCodeAt () Console.log (Str.charaT (0)); Console.log (str.charcodeat (0));//String Connection concat (), more convenient for var str1= ' Lio ' with plus sign; var li=new strobj ();// Concat connection Li.concats (STR,STR1);//slice cut li.slices (str);//substr select several li.substrs (str) from the first;// Substring from the first few li.substrings (str);//indexof character position li.indexofs (str);//lastindexofli.lastindexofs (str);//trim Delete Space Li.trims ("Lio ai Sanmei");//Case Conversion li.touppers (str); li.tolowers (str);//String Match </script>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
JS character turn processing