نسخ رمز رمز على النحو التالي:
/**
* طريقة StartWith ممتدة
* param str
* @يعود
*/
string.prototype.startwith = function (str) {
if (str == null || str == "" || this.length == 0 || str.length> this.length)
العودة كاذبة
if (this.substr (0 ، str.length) == Str)
العودة صحيح.
آخر
العودة كاذبة
العودة صحيح.
} ؛
/**
* تمديد الطريقة التي تحتوي على
* param item
* @يعود
*/
Array.Prototype.contains = دالة (عنصر) {
إرجاع regexp ("// b"+item+"// b").
} ؛
/**
* IE لا يدعم طريقة الفهرس ، إضافة طريقة indexof إلى أي
*/
Array.Prototype.indexof = function (val) {
var value = this ؛
لـ (var i = 0 ؛ i <value.length ؛ i ++) {
إذا (القيمة [i] == val) return i ؛
}
العودة -1 ؛
} ؛