获取字符串的最后一位

var str = 'hello';
String.prototype.lastValue = function(){
    return this.charAt(this.length-1);
};
alert( str.lastValue() );  //o

 

posted @ 2017-12-04 15:23  念念念不忘  阅读(317)  评论(0)    收藏  举报