check if set has value js
const mySet = new Set();
// Add value to set
mySet.add(15);
console.log(mySet.has(33)) // expected output: false
cosole.log(mySet.has(15)) // expected output: true
check if set has value js
const mySet = new Set();
// Add value to set
mySet.add(15);
console.log(mySet.has(33)) // expected output: false
cosole.log(mySet.has(15)) // expected output: true
javascript check if set contains
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
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us