小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

前端教程:JavascriptString.charAt()方法

 碼農(nóng)9527 2021-09-08

    這個(gè)方法返回從指定索引的字符。字符串中的字符進(jìn)行索引從左向右。第一個(gè)字符的索引是0,并且在一個(gè)叫stringName字符串的最后一個(gè)字符的索引是stringName.length-1。

前端教程:JavascriptString.charAt()方法

    語(yǔ)法

string.charAt(index);1復(fù)制代碼類型:[javascript]

    下面是參數(shù)的詳細(xì)信息:

    index: 介于0和1比串的長(zhǎng)度以下的整數(shù)。

    返回值:

    返回從指定索引的字符。

    例子:

<html><head><title>JavaScript String charAt() Method</title></head><body><script type="text/javascript">
   var str = new String( "This is string" );   document.writeln("str.charAt(0) is:" + str.charAt(0)); 
   document.writeln("<br />str.charAt(1) is:" + str.charAt(1)); 
   document.writeln("<br />str.charAt(2) is:" + str.charAt(2)); 
   document.writeln("<br />str.charAt(3) is:" + str.charAt(3)); 
   document.writeln("<br />str.charAt(4) is:" + str.charAt(4)); 
   document.writeln("<br />str.charAt(5) is:" + str.charAt(5)); 
</script></body></html>12345678910111213141516復(fù)制代碼類型:[javascript]

    這將產(chǎn)生以下結(jié)果:

str.charAt(0) is:T 
str.charAt(1) is:h 
str.charAt(2) is:i 
str.charAt(3) is:s 
str.charAt(4) is: 
str.charAt(5) is:i

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多