From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../reference/global_objects/set/has/index.html | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 files/ru/web/javascript/reference/global_objects/set/has/index.html (limited to 'files/ru/web/javascript/reference/global_objects/set/has/index.html') diff --git a/files/ru/web/javascript/reference/global_objects/set/has/index.html b/files/ru/web/javascript/reference/global_objects/set/has/index.html new file mode 100644 index 0000000000..45a5de9131 --- /dev/null +++ b/files/ru/web/javascript/reference/global_objects/set/has/index.html @@ -0,0 +1,91 @@ +--- +title: Set.prototype.has() +slug: Web/JavaScript/Reference/Global_Objects/Set/has +translation_of: Web/JavaScript/Reference/Global_Objects/Set/has +--- +
{{JSRef}}
+ +

Метод  has() возвращает логическое значение, показывающее, существует ли элемент с указанным значением в объекте  Set или нет.

+ +
{{EmbedInteractiveExample("pages/js/set-prototype-has.html")}}
+ + + +

Syntax

+ +
mySet.has(value);
+ +

Parameters

+ +
+
value
+
Required. The value to test for presence in the Set object.
+
+ +

Return value

+ +
+
Boolean
+
+

Returns true if an element with the specified value exists in the Set object; otherwise false.

+ +
+

Note: Technically speaking, has() uses the sameValueZero algorithm to determine whether the given element is found.

+
+
+
+ +

Examples

+ +

Using the has method

+ +
var mySet = new Set();
+mySet.add('foo');
+
+mySet.has('foo');  // returns true
+mySet.has('bar');  // returns false
+
+var set1 = new Set();
+var obj1 = {'key1': 1};
+set1.add(obj1);
+
+set1.has(obj1);        // returns true
+set1.has({'key1': 1}); // returns false because they are different object references
+set1.add({'key1': 1}); // now set1 contains 2 entries
+
+ +

Specifications

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-set.prototype.has', 'Set.prototype.has')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-set.prototype.has', 'Set.prototype.has')}}{{Spec2('ESDraft')}} 
+ +

Browser compatibility

+ + + +

{{Compat("javascript.builtins.Set.has")}}

+ +

See also

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