如下圖所示:複製程式碼如下: /*取得指定長度的最右邊的子字串,來自 String 物件。 */ String.prototype.right = 函數(length_) { var _from = this.length - length_;如果 (_from < 0) _from = 0;返回 this.substring(this.length - length_, this.length); };