freeCodeCamp/Data Structures/es6SetHasAndSize.js

9 lines
309 B
JavaScript

// 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
}