From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- .../deprecated_and_obsolete_features/index.html | 293 +++++++++++++++++++++ .../the_legacy_iterator_protocol/index.html | 76 ++++++ 2 files changed, 369 insertions(+) create mode 100644 files/uk/web/javascript/reference/deprecated_and_obsolete_features/index.html create mode 100644 files/uk/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html (limited to 'files/uk/web/javascript/reference/deprecated_and_obsolete_features') diff --git a/files/uk/web/javascript/reference/deprecated_and_obsolete_features/index.html b/files/uk/web/javascript/reference/deprecated_and_obsolete_features/index.html new file mode 100644 index 0000000000..bb1159f6d0 --- /dev/null +++ b/files/uk/web/javascript/reference/deprecated_and_obsolete_features/index.html @@ -0,0 +1,293 @@ +--- +title: Deprecated and obsolete features +slug: Web/JavaScript/Reference/Deprecated_and_obsolete_features +tags: + - Deprecated + - JavaScript + - NeedsTranslation + - Obsolete + - TopicStub +translation_of: Web/JavaScript/Reference/Deprecated_and_obsolete_features +--- +

{{JsSidebar("More")}}

+ +

This page lists features of JavaScript that are deprecated (that is, still available but planned for removal) and obsolete (that is, no longer usable).

+ +

Deprecated features

+ +

These deprecated features can still be used, but should be used with caution because they are expected to be removed entirely sometime in the future. You should work to remove their use from your code.

+ +

RegExp properties

+ +

the following properties are deprecated. This does not affect their use in {{jsxref("String.replace", "replacement strings", "", 1)}}:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyDescription
{{jsxref("RegExp.n", "$1-$9")}} +

Parenthesized substring matches, if any.
+ Warning: Using these properties can result in problems, since browser extensions can modify them. Avoid them!

+
{{jsxref("RegExp.input", "$_")}}See input.
{{jsxref("RegExp.multiline", "$*")}}See multiline.
{{jsxref("RegExp.lastMatch", "$&")}}See lastMatch.
{{jsxref("RegExp.lastParen", "$+")}}See lastParen.
{{jsxref("RegExp.leftContext", "$`")}}See leftContext.
{{jsxref("RegExp.rightContext", "$'")}}See rightContext.
{{jsxref("RegExp.input", "input")}}The string against which a regular expression is matched.
{{jsxref("RegExp.lastMatch", "lastMatch")}}The last matched characters.
{{jsxref("RegExp.lastParen", "lastParen")}}The last parenthesized substring match, if any.
{{jsxref("RegExp.leftContext", "leftContext")}}The substring preceding the most recent match.
{{jsxref("RegExp.rightContext", "rightContext")}}The substring following the most recent match.
+ +

The following are now properties of RegExp instances, no longer of the RegExp object:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyDescription
{{jsxref("RegExp.global", "global")}}Whether or not to test the regular expression against all possible matches in a string, or only against the first.
{{jsxref("RegExp.ignoreCase", "ignoreCase")}}Whether or not to ignore case while attempting a match in a string.
{{jsxref("RegExp.lastIndex", "lastIndex")}}The index at which to start the next match.
{{jsxref("RegExp.multiline", "multiline")}}Whether or not to search in strings across multiple lines.
{{jsxref("RegExp.source", "source")}}The text of the pattern.
+ +

RegExp methods

+ + + +

Function properties

+ + + +

Legacy generator

+ + + +

Iterator

+ + + +

Object methods

+ + + +

Date methods

+ + + +

Functions

+ + + +

Proxy

+ + + +

Escape sequences

+ + + +

String methods

+ + + +

Obsolete features

+ +

These obsolete features have been entirely removed from JavaScript and can no longer be used as of the indicated version of JavaScript.

+ +

Object

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyDescription
{{jsxref("Global_Objects/Object/count", "__count__")}}Returns the number of enumerable properties directly on a user-defined object.
{{jsxref("Global_Objects/Object/Parent", "__parent__")}}Points to an object's context.
{{jsxref("Global_Objects/Object/eval", "Object.prototype.eval()")}}Evaluates a string of JavaScript code in the context of the specified object.
{{jsxref("Object.observe()")}}Asynchronously observing the changes to an object.
{{jsxref("Object.unobserve()")}}Remove observers.
{{jsxref("Object.getNotifier()")}}Creates an object that allows to synthetically trigger a change.
+ +

Function

+ + + + + + + + + + + + +
PropertyDescription
{{jsxref("Global_Objects/Function/arity", "arity")}}Number of formal arguments.
+ +

Array

+ + + + + + + + + + + + + + + + +
PropertyDescription
{{jsxref("Array.observe()")}}Asynchronously observing changes to Arrays.
{{jsxref("Array.unobserve()")}}Remove observers.
+ +

Number

+ + + +

ParallelArray

+ + + +

Statements

+ + + +

E4X

+ +

See E4X for more information.

+ +

Sharp variables

+ +

See Sharp variables in JavaScript for more information.

diff --git a/files/uk/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html b/files/uk/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html new file mode 100644 index 0000000000..3dce39dba0 --- /dev/null +++ b/files/uk/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html @@ -0,0 +1,76 @@ +--- +title: Протокол застарілого ітератора +slug: >- + Web/JavaScript/Reference/Deprecated_and_obsolete_features/The_legacy_Iterator_protocol +tags: + - ECMAScript 2015 + - JavaScript + - застарілий ітератор +translation_of: >- + Web/JavaScript/Reference/Deprecated_and_obsolete_features/The_legacy_Iterator_protocol +--- +
{{jsSidebar("More")}}
+ +
Нестандартний. Протокол застарілого ітератора був особливою функціональністю SpiderMonkey, яка була прибрана у Firefox 58+. Для використання у майбутньому розгляньте цикли for..of та протокол ітератора.
+ +

Протокол застарілого ітератора лише для Firefox

+ +

Firefox, до версії 26, реалізовував інший протокол ітератора, схожий на стандартний Протокол ітератора ES2015.

+ +

Об'єкт є застарілим ітератором, коли реалізує метод next() з наступною семантикою, та викидає {{jsxref("Global_Objects/StopIteration", "StopIteration")}} в кінці перебору.

+ + + + + + + + + + + + +
ВластивістьЗначення
nextФункція з нулем аргументів, яка повертає значення.
+ +

Різниця між протоколами ітератора ES2015 та застарілого ітератора

+ + + +

Простий приклад зі старим протоколом

+ +
function makeIterator(array){
+    var nextIndex = 0;
+
+    return {
+       next: function(){
+           if(nextIndex < array.length){
+               return array[nextIndex++];
+           else
+               throw new StopIteration();
+       }
+    }
+}
+
+var it = makeIterator(['yo', 'ya']);
+
+console.log(it.next()); // 'yo'
+console.log(it.next()); // 'ya'
+try{
+    console.log(it.next());
+}
+catch(e){
+    if(e instanceof StopIteration){
+         // перебір завершено
+    }
+}
+
+ +

Див. також

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