Data Structures: Use .has and .size on an ES6 Set
This commit is contained in:
parent
8eca0e5f25
commit
0973091ac5
8
Data Structures/es6SetHasAndSize.js
Normal file
8
Data Structures/es6SetHasAndSize.js
Normal file
@ -0,0 +1,8 @@
|
||||
// https://www.freecodecamp.org/learn/coding-interview-prep/data-structures/use--has-and--size-on-an-es6-set
|
||||
|
||||
function checkSet(arrToBeSet, checkValue) {
|
||||
// Only change code below this line
|
||||
const set = new Set(arrToBeSet);
|
||||
return [set.has(checkValue), set.size];
|
||||
// Only change code above this line
|
||||
}
|
Loading…
Reference in New Issue
Block a user