Fill in the blanks to create a new set "c", with only the values common to both "a" and "b", if not all of the values of set "a" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Fill in the blanks to create a new set "c", with only the values common to both "a" and "b", if not all of the values of set "a"

I DONT UNDERSTAND

14th Sep 2016, 12:20 AM
Enoch George
Enoch George - avatar
11 Answers
+ 11
Fill in the blanks to create and output a set with the values 1, 2, 3. const set = new Set(); set.add(1).add(2). add (3); for(let v of set.values()) console.log( v );
10th Feb 2020, 8:45 AM
Pranjal Singh
Pranjal Singh - avatar
+ 4
All values of Set A are contained in Set B means --> A is a Subset of B. a.Subset(b) In question, we need the reverse condition --> A is not a Subset of B. So, the condition becomes : if ! a. Subset(b) { } Then, we need values common to both sets A & B ==> Intersection of sets A & B. So, the entire code snippet becomes: if ! a. Subset(b) { let c: = a. intersect(b) }
24th Dec 2016, 6:01 AM
Alen Alexander
Alen Alexander - avatar
+ 3
Fill in the blanks to create a new set "c", with only the values common to both "a" and "b", if not all of the values of set "a" are contained in set "b". let a: Set = [1, 2, 3] let b: Set = [3, 5, 2] if ! a. (b) { let c: isSubsetOf = a. (b) } I don't understand
14th Sep 2016, 12:21 AM
Enoch George
Enoch George - avatar
+ 3
Fill in the blanks to create and output a set with the values 1, 2, 3. const set = new Set(); set.add(1).add(2). add (3); for(let v of set.values()) console.log( v );
24th Dec 2019, 9:31 AM
Rana Abid
Rana Abid - avatar
+ 3
new add v
25th Jul 2020, 4:16 PM
Ekundayo Timileyin
+ 1
thanks :)
27th Dec 2016, 3:53 PM
Mahedi Hasan Prince
Mahedi Hasan Prince - avatar
0
Fill in the blanks to create and output a set with the values 1, 2, 3. const set = Set(); set.add(1).add(2). (3); for(let v of set.values()) console.log( );
19th Jun 2020, 4:38 AM
TRINH SON
TRINH SON - avatar
0
1. subset 2. set 3. intersection
18th Sep 2020, 6:07 PM
Arbab ul Hassan
0
onst set = new Set(); set.add(1).add(2). add (3); for(let v of set.values()) console.log( v );
3rd Dec 2020, 7:50 PM
El Maslohi Hassan
0
new add v
20th Sep 2022, 11:50 AM
LIPSA BEHERA
0
Fill in the blanks to create and output a set with the values 1, 2, 3. const set = new Set(); set.add(1).add(2). add (3); for(let v of set.values()) console.log( v );
10th Mar 2023, 6:42 PM
Krishn Kant Sharma
Krishn Kant Sharma - avatar