From 43a5cac2eff22c21071800e13bef12af9d3a37d0 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 13:12:08 +0100 Subject: unslug zh-tw: move --- .../arraybuffer/prototype/index.html | 111 ---------- .../global_objects/date/prototype/index.html | 246 --------------------- .../global_objects/function/prototype/index.html | 139 ------------ .../global_objects/number/prototype/index.html | 85 ------- .../global_objects/object/prototype/index.html | 219 ------------------ .../global_objects/promise/prototype/index.html | 65 ------ .../global_objects/string/prototype/index.html | 177 --------------- 7 files changed, 1042 deletions(-) delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html (limited to 'files/zh-tw/web/javascript/reference/global_objects') diff --git a/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html deleted file mode 100644 index 263726d7e0..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: ArrayBuffer.prototype -slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/prototype -translation_of: Web/JavaScript/Reference/Global_Objects/ArrayBuffer -translation_of_original: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/prototype ---- -
{{JSRef}}
- -

The ArrayBuffer.prototype property represents the prototype for the {{jsxref("ArrayBuffer")}} object.

- -
{{js_property_attributes(0,0,0)}}
- -

描述

- -

ArrayBuffer instances inherit from ArrayBuffer.prototype. As with all constructors, you can change the constructor's prototype object to make changes to all ArrayBuffer instances.

- -

屬性

- -
-
ArrayBuffer.prototype.constructor
-
Specifies the function that creates an object's prototype. The initial value is the standard built-in ArrayBuffer constructor.
-
{{jsxref("ArrayBuffer.prototype.byteLength")}} {{readonlyInline}}
-
陣列大小,以位元組(byte)計算。此屬性在陣列建立之後就不可能改變了。唯讀
-
- -

方法

- -
-
{{jsxref("ArrayBuffer.prototype.slice()")}}
-
Returns a new ArrayBuffer whose contents are a copy of this ArrayBuffer's bytes from begin, inclusive, up to end, exclusive. If either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning.
-
- -

規範

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES6', '#sec-arraybuffer.prototype', 'ArrayBuffer.prototype')}}{{Spec2('ES6')}}Initial definition.
{{SpecName('ESDraft', '#sec-arraybuffer.prototype', 'ArrayBuffer.prototype')}}{{Spec2('ESDraft')}} 
- -

瀏覽器相容性

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support7.0{{ CompatGeckoDesktop("2")}}1011.65.1
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support4.0{{CompatVersionUnknown}}{{CompatGeckoMobile("2")}}1011.64.2
-
- -

參見

- - diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html deleted file mode 100644 index 5490743ec0..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html +++ /dev/null @@ -1,246 +0,0 @@ ---- -title: Date.prototype -slug: Web/JavaScript/Reference/Global_Objects/Date/prototype -tags: - - Date - - JavaScript - - 原型 - - 參考資料 - - 屬性 -translation_of: Web/JavaScript/Reference/Global_Objects/Date -translation_of_original: Web/JavaScript/Reference/Global_Objects/Date/prototype ---- -
{{JSRef}}
- -

Date.prototype 屬性表示 {{jsxref("Date")}} 建構子的原型。

- -
{{js_property_attributes(0, 0, 1)}}
- -

描述

- -

JavaScript {{jsxref("Date")}} 實體繼承自 Date.prototype。你可以藉由改變建構子的原型物件,來影響所有繼承自 JavaScript {{jsxref("Date")}} 的實體。

- -

為了千年年份(換個說法,考慮現在已到了 2000 年)的相容性,設定上你應該採用完整的年份。舉例來說,使用 1998 而不是 98 。為了讓你能取得完整的年份資料, Javascript 包含了 {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}} , {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}} , {{jsxref("Date.prototype.getUTCFullYear()", "getUTCFullYear()")}} 以及 {{jsxref("Date.prototype.setUTCFullYear()", "setUTCFullYear()")}} 方法。

- -

自 ECMAScript 6 開始, Date.prototype 物件只是個一般物件,而不是一個 {{jsxref("Date")}} 實體。

- -

屬性

- -
-
Date.prototype.constructor
-
回傳一個能建立實體的函數,這是 {{jsxref("Date")}} 預設的建構子。
-
- -

方法

- -

Getter

- -
-
{{jsxref("Date.prototype.getDate()")}}
-
回傳本地時間月份中的日期(1-31)。
-
{{jsxref("Date.prototype.getDay()")}}
-
回傳本地時間星期中的日子(0-6)。
-
{{jsxref("Date.prototype.getFullYear()")}}
-
回傳本地時間的年份( 以 4 位數表現)。
-
{{jsxref("Date.prototype.getHours()")}}
-
回傳本地時間的小時(0-23)。
-
{{jsxref("Date.prototype.getMilliseconds()")}}
-
回傳本地時間的毫秒數(0-999)。
-
{{jsxref("Date.prototype.getMinutes()")}}
-
回傳本地時間的分鐘數(0-59)。
-
{{jsxref("Date.prototype.getMonth()")}}
-
回傳本地時間的月份(0-11)。
-
{{jsxref("Date.prototype.getSeconds()")}}
-
回傳本地時間的秒數(0-59)。
-
{{jsxref("Date.prototype.getTime()")}}
-
回傳由 1970-01-01 00:00:00 UTC 開始,到代表時間經過的毫秒數(以負值表示 1970 年之前的時間)。
-
{{jsxref("Date.prototype.getTimezoneOffset()")}}
-
回傳本地時差為多少分鐘。
-
{{jsxref("Date.prototype.getUTCDate()")}}
-
回傳標準時間的在月份中的日期(1-31)。
-
{{jsxref("Date.prototype.getUTCDay()")}}
-
回傳標準時間在星期中的日子(0-6)。
-
{{jsxref("Date.prototype.getUTCFullYear()")}}
-
回傳標準時間的年份( 以 4 位數表現)。
-
{{jsxref("Date.prototype.getUTCHours()")}}
-
回傳標準時間的小時數(0-23)。
-
{{jsxref("Date.prototype.getUTCMilliseconds()")}}
-
回傳標準時間裡的毫秒數(0-999)。
-
{{jsxref("Date.prototype.getUTCMinutes()")}}
-
回傳標準時間的分鐘數(0-59)。
-
{{jsxref("Date.prototype.getUTCMonth()")}}
-
回傳標準時間的月份數(0-11)。
-
{{jsxref("Date.prototype.getUTCSeconds()")}}
-
回傳標準時間的秒數(0-59)。
-
{{jsxref("Date.prototype.getYear()")}} {{deprecated_inline}}
-
回本地時間的年份(通常 2-3 位數)。用 {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}} 取代。
-
- -

Setter

- -
-
{{jsxref("Date.prototype.setDate()")}}
-
設定本地時間月份中的日期。
-
{{jsxref("Date.prototype.setFullYear()")}}
-
設定本地時間的完整年份(以 4 位數表達 4 位數年份)。
-
{{jsxref("Date.prototype.setHours()")}}
-
設定本地時間的小時數。
-
{{jsxref("Date.prototype.setMilliseconds()")}}
-
設定本地時間的毫秒數。
-
{{jsxref("Date.prototype.setMinutes()")}}
-
設定本地時間的分鐘數。
-
{{jsxref("Date.prototype.setMonth()")}}
-
設定本地時間的月份。
-
{{jsxref("Date.prototype.setSeconds()")}}
-
設定本地時間的秒數。
-
{{jsxref("Date.prototype.setTime()")}}
-
設定這個 {{jsxref("Date")}} 物件距 1970-01-01 00:00:00 UTC 的毫秒數,允許使用負值表示之前的時間。
-
{{jsxref("Date.prototype.setUTCDate()")}}
-
設定標準時間月份中的日期。
-
{{jsxref("Date.prototype.setUTCFullYear()")}}
-
設定標準時間的完整年份(以 4 位數表示 4 位數年分)。
-
{{jsxref("Date.prototype.setUTCHours()")}}
-
設定標準時間的小時數。
-
{{jsxref("Date.prototype.setUTCMilliseconds()")}}
-
設定標準時間的毫秒數。
-
{{jsxref("Date.prototype.setUTCMinutes()")}}
-
設定標準時間的分鐘數。
-
{{jsxref("Date.prototype.setUTCMonth()")}}
-
設定標準時間的月份數。
-
{{jsxref("Date.prototype.setUTCSeconds()")}}
-
設定標準時間的秒數。
-
{{jsxref("Date.prototype.setYear()")}} {{deprecated_inline}}
-
設定本地時間的年份(使用 2-3 位數)。使用 {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}} 取代。
-
- -

Conversion getter

- -
-
{{jsxref("Date.prototype.toDateString()")}}
-
以可閱讀的字串型式,回傳 {{jsxref("Date")}} 的部分資訊。
-
{{jsxref("Date.prototype.toISOString()")}}
-
將日期時間轉換成 ISO 8601 格式的字串回傳。
-
{{jsxref("Date.prototype.toJSON()")}}
-
回傳等義於 {{jsxref("Date")}} 物件使用 {{jsxref("Date.prototype.toISOString()", "toISOString()")}} 方法的結果。特別使用 {{jsxref("JSON.stringify()")}} 處理。
-
{{jsxref("Date.prototype.toGMTString()")}} {{deprecated_inline}}
-
回傳 {{jsxref("Date")}} 以 GMT (UT) 時區基準代表的時間字串。使用 {{jsxref("Date.prototype.toUTCString()", "toUTCString()")}} 方法來取代。
-
{{jsxref("Date.prototype.toLocaleDateString()")}}
-
依照系統的時間地區設定,回傳日期字串。
-
{{jsxref("Date.prototype.toLocaleFormat()")}} {{non-standard_inline}}
-
傳入格式化字串參數,將日期時間轉換成指定格式的字串。
-
{{jsxref("Date.prototype.toLocaleString()")}}
-
回傳依系統的地區設定導出的日期時間字串。覆寫自 {{jsxref("Object.prototype.toLocaleString()")}} 方法。
-
{{jsxref("Date.prototype.toLocaleTimeString()")}}
-
回傳依系統的地區設定導出的時間字串。
-
{{jsxref("Date.prototype.toSource()")}} {{non-standard_inline}}
-
回傳一個建立相同 {{jsxref("Date")}} 物件的程式碼字串;你可以拿這個結果來建立新物件。覆寫自 {{jsxref("Object.prototype.toSource()")}} 方法。
-
{{jsxref("Date.prototype.toString()")}}
-
回傳代表此 {{jsxref("Date")}} 物件的字串。覆寫自 {{jsxref("Object.prototype.toString()")}} 方法。
-
{{jsxref("Date.prototype.toTimeString()")}}
-
以人類可讀的格式,回傳時間部分的字串。
-
{{jsxref("Date.prototype.toUTCString()")}}
-
依 UTC 時區,轉換出時間日期字串。
-
{{jsxref("Date.prototype.valueOf()")}}
-
回傳 {{jsxref("Date")}} 物件的原始數值。覆寫自 {{jsxref("Object.prototype.valueOf()")}} 方法。
-
- -

規範

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
規範狀態
{{SpecName('ES1')}}{{Spec2('ES1')}}初步定義。實作在 JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.9.5', 'Date.prototype')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}{{Spec2('ESDraft')}} 
- -

瀏覽器相容性

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
平台ChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本支援{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
一般物件{{CompatUnknown}}{{CompatGeckoDesktop("41")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
平台AndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本支援{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
一般物件{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile("41")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html deleted file mode 100644 index 718454721b..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html +++ /dev/null @@ -1,139 +0,0 @@ ---- -title: Function.prototype -slug: Web/JavaScript/Reference/Global_Objects/Function/prototype -translation_of: Web/JavaScript/Reference/Global_Objects/Function -translation_of_original: Web/JavaScript/Reference/Global_Objects/Function/prototype ---- -
{{JSRef}}
- -

Function.prototype 屬性表示 {{jsxref("Function")}} 的原型物件。

- -

描述

- -

{{jsxref("Function")}} objects inherit from Function.prototypeFunction.prototype cannot be modified.

- -

屬性

- -
-
{{jsxref("Function.arguments")}} {{deprecated_inline}}
-
An array corresponding to the arguments passed to a function. This is deprecated as property of {{jsxref("Function")}}, use the {{jsxref("Functions/arguments", "arguments")}} object available within the function instead.
-
{{jsxref("Function.arity")}} {{obsolete_inline}}
-
Used to specifiy the number of arguments expected by the function, but has been removed. Use the {{jsxref("Function.length", "length")}} property instead.
-
{{jsxref("Function.caller")}} {{non-standard_inline}}
-
Specifies the function that invoked the currently executing function.
-
{{jsxref("Function.length")}}
-
Specifies the number of arguments expected by the function.
-
{{jsxref("Function.name")}}
-
The name of the function.
-
{{jsxref("Function.displayName")}} {{non-standard_inline}}
-
The display name of the function.
-
Function.prototype.constructor
-
Specifies the function that creates an object's prototype. See {{jsxref("Object.prototype.constructor")}} for more details.
-
- -

方法

- -
-
{{jsxref("Function.prototype.apply()")}}
-
Calls a function and sets its this to the provided value, arguments can be passed as an {{jsxref("Array")}} object.
-
{{jsxref("Function.prototype.bind()")}}
-
Creates a new function which, when called, has its this set to the provided value, with a given sequence of arguments preceding any provided when the new function was called.
-
{{jsxref("Function.prototype.call()")}}
-
Calls (executes) a function and sets its this to the provided value, arguments can be passed as they are.
-
{{jsxref("Function.prototype.isGenerator()")}} {{non-standard_inline}}
-
Returns true if the function is a generator; otherwise returns false.
-
{{jsxref("Function.prototype.toSource()")}} {{non-standard_inline}}
-
Returns a string representing the source code of the function. Overrides the {{jsxref("Object.prototype.toSource")}} method.
-
{{jsxref("Function.prototype.toString()")}}
-
Returns a string representing the source code of the function. Overrides the {{jsxref("Object.prototype.toString")}} method.
-
- -

規範

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1
{{SpecName('ES5.1', '#sec-15.3.5.2', 'Function.prototype')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-function-instances-prototype', 'Function.prototype')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-function-instances-prototype', 'Function.prototype')}}{{Spec2('ESDraft')}} 
- -

瀏覽器相容性

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

參見

- - diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html deleted file mode 100644 index bfd57f3d21..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: Number.prototype -slug: Web/JavaScript/Reference/Global_Objects/Number/prototype -translation_of: Web/JavaScript/Reference/Global_Objects/Number -translation_of_original: Web/JavaScript/Reference/Global_Objects/Number/prototype ---- -
{{JSRef}}
- -

Number.prototype 屬性用來表示 {{jsxref("Number")}} 建構式的原型。

- -
{{js_property_attributes(0, 0, 0)}}
- -

說明

- -

所有 {{jsxref("Number")}} 實體都繼承自 Number.prototype 。{{jsxref("Number")}} 建構式的原型物件可以被修改並作用在所有 {{jsxref("Number")}} 實體。

- -

屬性

- -
-
Number.prototype.constructor
-
回傳建立這個物件實體的建構式。預設為 {{jsxref("Number")}} 物件。
-
- -

方法

- -
-
{{jsxref("Number.prototype.toExponential()")}}
-
回傳以「科學記數法」表示的數值字串。
-
{{jsxref("Number.prototype.toFixed()")}}
-
回傳以定點表示的數值字串。
-
{{jsxref("Number.prototype.toLocaleString()")}}
-
回傳以當地語言為主的數值字串。這覆寫 {{jsxref("Object.prototype.toLocaleString()")}} 的方法。
-
{{jsxref("Number.prototype.toPrecision()")}}
-
回傳以定點或科學記數表示的數值字串。
-
{{jsxref("Number.prototype.toSource()")}} {{non-standard_inline}}
-
Returns an object literal representing the specified {{jsxref("Number")}} object; you can use this value to create a new object. Overrides the {{jsxref("Object.prototype.toSource()")}} method.
-
{{jsxref("Number.prototype.toString()")}}
-
回傳以特定基數表示的數值字串。這覆寫 {{jsxref("Object.prototype.toString()")}} 的方法 。
-
{{jsxref("Number.prototype.valueOf()")}}
-
回傳這個物件的原始型別,即原始數值。這覆寫 {{jsxref("Object.prototype.valueOf()")}} 。
-
- -

規範

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
規範狀態註記
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.7.4', 'Number')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-properties-of-the-number-prototype-object', 'Number')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-properties-of-the-number-prototype-object', 'Number')}}{{Spec2('ESDraft')}} 
- -

瀏覽器相容性

- - - -

{{Compat("javascript.builtins.Number.prototype")}}

- -

參見

- - diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html deleted file mode 100644 index 4365b10c61..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html +++ /dev/null @@ -1,219 +0,0 @@ ---- -title: Object.prototype -slug: Web/JavaScript/Reference/Global_Objects/Object/prototype -tags: - - JavaScript - - Object - - 待翻譯 -translation_of: Web/JavaScript/Reference/Global_Objects/Object -translation_of_original: Web/JavaScript/Reference/Global_Objects/Object/prototype ---- -
{{JSRef}}
- -

Object.prototype 代表 {{jsxref("Object")}} 的原型物件。

- -
{{js_property_attributes(0, 0, 0)}}
- -

描述

- -

All objects in JavaScript are descended from {{jsxref("Object")}}; all objects inherit methods and properties from Object.prototype, although they may be overridden (except an Object with a null prototype, i.e. Object.create(null)). For example, other constructors' prototypes override the constructor property and provide their own {{jsxref("Object.prototype.toString()", "toString()")}} methods. Changes to the Object prototype object are propagated to all objects unless the properties and methods subject to those changes are overridden further along the prototype chain.

- -

屬性

- -
-
{{jsxref("Object.prototype.constructor")}}
-
Specifies the function that creates an object's prototype.
-
{{jsxref("Object.prototype.__proto__")}} {{non-standard_inline}}
-
Points to the object which was used as prototype when the object was instantiated.
-
{{jsxref("Object.prototype.__noSuchMethod__")}} {{non-standard_inline}}
-
Allows a function to be defined that will be executed when an undefined object member is called as a method.
-
{{jsxref("Object.prototype.__count__")}} {{obsolete_inline}}
-
Used to return the number of enumerable properties directly on a user-defined object, but has been removed.
-
{{jsxref("Object.prototype.__parent__")}} {{obsolete_inline}}
-
Used to point to an object's context, but has been removed.
-
- -

方法

- -
-
{{jsxref("Object.prototype.__defineGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}
-
Associates a function with a property that, when accessed, executes that function and returns its return value.
-
{{jsxref("Object.prototype.__defineSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}
-
Associates a function with a property that, when set, executes that function which modifies the property.
-
{{jsxref("Object.prototype.__lookupGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}
-
Returns the function associated with the specified property by the {{jsxref("Object.defineGetter", "__defineGetter__")}} method.
-
{{jsxref("Object.prototype.__lookupSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}
-
Returns the function associated with the specified property by the {{jsxref("Object.defineSetter", "__defineSetter__")}} method.
-
{{jsxref("Object.prototype.hasOwnProperty()")}}
-
Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain.
-
{{jsxref("Object.prototype.isPrototypeOf()")}}
-
Returns a boolean indication whether the specified object is in the prototype chain of the object this method is called upon.
-
{{jsxref("Object.prototype.propertyIsEnumerable()")}}
-
Returns a boolean indicating if the internal ECMAScript DontEnum attribute is set.
-
{{jsxref("Object.prototype.toSource()")}} {{non-standard_inline}}
-
Returns string containing the source of an object literal representing the object that this method is called upon; you can use this value to create a new object.
-
{{jsxref("Object.prototype.toLocaleString()")}}
-
Calls {{jsxref("Object.toString", "toString()")}}.
-
{{jsxref("Object.prototype.toString()")}}
-
Returns a string representation of the object.
-
{{jsxref("Object.prototype.unwatch()")}} {{non-standard_inline}}
-
Removes a watchpoint from a property of the object.
-
{{jsxref("Object.prototype.valueOf()")}}
-
Returns the primitive value of the specified object.
-
{{jsxref("Object.prototype.watch()")}} {{non-standard_inline}}
-
Adds a watchpoint to a property of the object.
-
{{jsxref("Object.prototype.eval()")}} {{obsolete_inline}}
-
Used to evaluate a string of JavaScript code in the context of the specified object, but has been removed.
-
- -

範例

- -

因為 JavaScript 並沒有子類別的物件,所以原型是個很有用的解決辦法, 使某些函數作為物件的基本類別物件。例如:

- -
var Person = function() {
-  this.canTalk = true;
-};
-
-Person.prototype.greet = function() {
-  if (this.canTalk) {
-    console.log('Hi, I am ' + this.name);
-  }
-};
-
-var Employee = function(name, title) {
-  Person.call(this);
-  this.name = name;
-  this.title = title;
-};
-
-Employee.prototype = Object.create(Person.prototype);
-Employee.prototype.constructor = Employee;
-
-Employee.prototype.greet = function() {
-  if (this.canTalk) {
-    console.log('Hi, I am ' + this.name + ', the ' + this.title);
-  }
-};
-
-var Customer = function(name) {
-  Person.call(this);
-  this.name = name;
-};
-
-Customer.prototype = Object.create(Person.prototype);
-Customer.prototype.constructor = Customer;
-
-var Mime = function(name) {
-  Person.call(this);
-  this.name = name;
-  this.canTalk = false;
-};
-
-Mime.prototype = Object.create(Person.prototype);
-Mime.prototype.constructor = Mime;
-
-var bob = new Employee('Bob', 'Builder');
-var joe = new Customer('Joe');
-var rg = new Employee('Red Green', 'Handyman');
-var mike = new Customer('Mike');
-var mime = new Mime('Mime');
-
-bob.greet();
-// Hi, I am Bob, the Builder
-
-joe.greet();
-// Hi, I am Joe
-
-rg.greet();
-// Hi, I am Red Green, the Handyman
-
-mike.greet();
-// Hi, I am Mike
-
-mime.greet();
-
- -

規範

- - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.2.3.1', 'Object.prototype')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-object.prototype', 'Object.prototype')}}{{Spec2('ES6')}} 
- -

瀏覽器相容性

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

參見

- - diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html deleted file mode 100644 index f93572bea3..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Promise.prototype -slug: Web/JavaScript/Reference/Global_Objects/Promise/prototype -translation_of: Web/JavaScript/Reference/Global_Objects/Promise -translation_of_original: Web/JavaScript/Reference/Global_Objects/Promise/prototype ---- -
{{JSRef}}
- -

Promise.prototype 屬性代表了 {{jsxref("Promise")}} 建構式的原型物件。

- -
{{js_property_attributes(0,0,0)}}
- -

描述

- -

所有 {{jsxref("Promise")}} 實例都繼承自 {{jsxref("Promise.prototype")}}。您可以使用建構式的原型物件來增加屬性或方法到所有的 Promise 實例。

- -

屬性

- -
-
Promise.prototype.constructor
-
回傳一個建立實例原型(instance's prototype)的函式。預設為 {{jsxref("Promise")}} 函數。
-
- -

方法

- -
-
{{jsxref("Promise.catch", "Promise.prototype.catch(onRejected)")}}
-
繫結一個拒絕回呼函式(rejection handler callback)到 promise,當它被呼叫時回傳一個以回傳值作解析的新 promise,或者當 promise 被實現時以原值作解析。
-
{{jsxref("Promise.then", "Promise.prototype.then(onFulfilled, onRejected)")}}
-
繫結實現或拒絕回呼函式到 promise,回傳一個以 handler 之回傳值作解析的新 promise,或者當 promise 未處理(not handled)時以原值作解析。(i.e. 比如相關聯的 onFulfilled 或 onRejected 不是函式。)
-
- -

規範

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES6', '#sec-promise.prototype', 'Promise.prototype')}}{{Spec2('ES6')}}Initial definition.
{{SpecName('ESDraft', '#sec-promise.prototype', 'Promise.prototype')}}{{Spec2('ESDraft')}} 
- -

瀏覽器相容性

- - - -

{{Compat("javascript/promise","Promise.prototype")}}

- -

參見

- - diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html deleted file mode 100644 index 011c61418e..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html +++ /dev/null @@ -1,177 +0,0 @@ ---- -title: String.prototype -slug: Web/JavaScript/Reference/Global_Objects/String/prototype -translation_of: Web/JavaScript/Reference/Global_Objects/String -translation_of_original: Web/JavaScript/Reference/Global_Objects/String/prototype ---- -
{{JSRef}}
- -

The String.prototype property represents the {{jsxref("String")}} prototype object.

- -
{{js_property_attributes(0, 0, 0)}}
- -

Description

- -

All {{jsxref("String")}} instances inherit from String.prototype. Changes to the String prototype object are propagated to all {{jsxref("String")}} instances.

- -

Properties

- -
-
String.prototype.constructor
-
Specifies the function that creates an object's prototype.
-
{{jsxref("String.prototype.length")}}
-
Reflects the length of the string.
-
N
-
Used to access the character in the Nth position where N is a positive integer between 0 and one less than the value of {{jsxref("String.length", "length")}}. These properties are read-only.
-
- -

Methods

- -

Methods unrelated to HTML

- -
-
{{jsxref("String.prototype.charAt()")}}
-
Returns the character (exactly one UTF-16 code unit) at the specified index.
-
{{jsxref("String.prototype.charCodeAt()")}}
-
Returns a number that is the UTF-16 code unit value at the given index.
-
{{jsxref("String.prototype.codePointAt()")}}
-
Returns a nonnegative integer Number that is the code point value of the UTF-16 encoded code point starting at the specified index.
-
{{jsxref("String.prototype.concat()")}}
-
Combines the text of two strings and returns a new string.
-
{{jsxref("String.prototype.includes()")}}
-
Determines whether one string may be found within another string.
-
{{jsxref("String.prototype.endsWith()")}}
-
Determines whether a string ends with the characters of another string.
-
{{jsxref("String.prototype.indexOf()")}}
-
Returns the index within the calling {{jsxref("String")}} object of the first occurrence of the specified value, or -1 if not found.
-
{{jsxref("String.prototype.lastIndexOf()")}}
-
Returns the index within the calling {{jsxref("String")}} object of the last occurrence of the specified value, or -1 if not found.
-
{{jsxref("String.prototype.localeCompare()")}}
-
Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.
-
{{jsxref("String.prototype.match()")}}
-
Used to match a regular expression against a string.
-
{{jsxref("String.prototype.normalize()")}}
-
Returns the Unicode Normalization Form of the calling string value.
-
{{jsxref("String.prototype.padEnd()")}}
-
Pads the current string from the end with a given string to create a new string from a given length.
-
{{jsxref("String.prototype.padStart()")}}
-
Pads the current string from the start with a given string to create a new string from a given length.
-
{{jsxref("String.prototype.quote()")}} {{obsolete_inline}}
-
Wraps the string in double quotes (""").
-
{{jsxref("String.prototype.repeat()")}}
-
Returns a string consisting of the elements of the object repeated the given times.
-
{{jsxref("String.prototype.replace()")}}
-
Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.
-
{{jsxref("String.prototype.search()")}}
-
Executes the search for a match between a regular expression and a specified string.
-
{{jsxref("String.prototype.slice()")}}
-
Extracts a section of a string and returns a new string.
-
{{jsxref("String.prototype.split()")}}
-
Splits a {{jsxref("Global_Objects/String", "String")}} object into an array of strings by separating the string into substrings.
-
{{jsxref("String.prototype.startsWith()")}}
-
Determines whether a string begins with the characters of another string.
-
{{jsxref("String.prototype.substr()")}}
-
Returns the characters in a string beginning at the specified location through the specified number of characters.
-
{{jsxref("String.prototype.substring()")}}
-
Returns the characters in a string between two indexes into the string.
-
{{jsxref("String.prototype.toLocaleLowerCase()")}}
-
The characters within a string are converted to lower case while respecting the current locale. For most languages, this will return the same as {{jsxref("String.prototype.toLowerCase()", "toLowerCase()")}}.
-
{{jsxref("String.prototype.toLocaleUpperCase()")}}
-
The characters within a string are converted to upper case while respecting the current locale. For most languages, this will return the same as {{jsxref("String.prototype.toUpperCase()", "toUpperCase()")}}.
-
{{jsxref("String.prototype.toLowerCase()")}}
-
Returns the calling string value converted to lower case.
-
{{jsxref("String.prototype.toSource()")}} {{non-standard_inline}}
-
Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the {{jsxref("Object.prototype.toSource()")}} method.
-
{{jsxref("String.prototype.toString()")}}
-
Returns a string representing the specified object. Overrides the {{jsxref("Object.prototype.toString()")}} method.
-
{{jsxref("String.prototype.toUpperCase()")}}
-
Returns the calling string value converted to uppercase.
-
{{jsxref("String.prototype.trim()")}}
-
Trims whitespace from the beginning and end of the string. Part of the ECMAScript 5 standard.
-
{{jsxref("String.prototype.trimLeft()")}} {{non-standard_inline}}
-
Trims whitespace from the left side of the string.
-
{{jsxref("String.prototype.trimRight()")}} {{non-standard_inline}}
-
Trims whitespace from the right side of the string.
-
{{jsxref("String.prototype.valueOf()")}}
-
Returns the primitive value of the specified object. Overrides the {{jsxref("Object.prototype.valueOf()")}} method.
-
{{jsxref("String.prototype.@@iterator()", "String.prototype[@@iterator]()")}}
-
Returns a new Iterator object that iterates over the code points of a String value, returning each code point as a String value.
-
- -

HTML wrapper methods

- -

These methods are of limited use, as they provide only a subset of the available HTML tags and attributes.

- -
-
{{jsxref("String.prototype.anchor()")}}
-
{{htmlattrxref("name", "a", "<a name=\"name\">")}} (hypertext target)
-
{{jsxref("String.prototype.big()")}} {{deprecated_inline}}
-
{{HTMLElement("big")}}
-
{{jsxref("String.prototype.blink()")}} {{deprecated_inline}}
-
{{HTMLElement("blink")}}
-
{{jsxref("String.prototype.bold()")}} {{deprecated_inline}}
-
{{HTMLElement("b")}}
-
{{jsxref("String.prototype.fixed()")}} {{deprecated_inline}}
-
{{HTMLElement("tt")}}
-
{{jsxref("String.prototype.fontcolor()")}} {{deprecated_inline}}
-
{{htmlattrxref("color", "font", "<font color=\"color\">")}}
-
{{jsxref("String.prototype.fontsize()")}} {{deprecated_inline}}
-
{{htmlattrxref("size", "font", "<font size=\"size\">")}}
-
{{jsxref("String.prototype.italics()")}} {{deprecated_inline}}
-
{{HTMLElement("i")}}
-
{{jsxref("String.prototype.link()")}}
-
{{htmlattrxref("href", "a", "<a href=\"url\">")}} (link to URL)
-
{{jsxref("String.prototype.small()")}} {{deprecated_inline}}
-
{{HTMLElement("small")}}
-
{{jsxref("String.prototype.strike()")}} {{deprecated_inline}}
-
{{HTMLElement("strike")}}
-
{{jsxref("String.prototype.sub()")}} {{deprecated_inline}}
-
{{HTMLElement("sub")}}
-
{{jsxref("String.prototype.sup()")}} {{deprecated_inline}}
-
{{HTMLElement("sup")}}
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition.
{{SpecName('ES5.1', '#sec-15.5.3.1', 'String.prototype')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-string.prototype', 'String.prototype')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-string.prototype', 'String.prototype')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- - - -

{{Compat("javascript.builtins.String.prototype")}}

- -

See also

- - -- cgit v1.2.3-54-g00ecf