You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: challenges/collections.md
+86-59Lines changed: 86 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,36 +14,37 @@
14
14
8.[Write a program to replace 3 center elements of the 1st array by center 3 elements of the 2nd array](#Q8)
15
15
9.[Show how an array in JavaScript can act like a stack and queue](#Q9)
16
16
10.[Sort the given array of integers in ascending or descending order](#Q10)
17
-
11.[Square all the positive numbers of the array and return the output array](#Q11)
18
-
12.[Write a code to generate an array with range of numbers and shuffle them](#Q12)
19
-
13.[Check if the user with the name "John" exists in the array of objects](#Q13)
20
-
14.[Generate an array of objects with properties id and full name from an array of objects where each object will have id, firstname and lastname](#Q14)
21
-
15.[Create an array by removing all the holes of the array](#Q15)
22
-
16.[Write a program to calculate the sum of all the values of an array](#Q16)
23
-
17.[Get the maximum value from a numbers array along with its index](#Q17)
24
-
18.[Find the number of occurences of minimum value in the numbers list](#Q18)
25
-
19.[Create an array of length n with all the values of it set to 10](#Q19)
26
-
20.[Optimize the given statements having lot of logical checks to use a compact and cleaner logic](#Q20)
27
-
21.[Write a program to iterate over a 2 dimensional array and print all the values of it](#Q21)
28
-
22.[Write a program to store values in to a set](#Q22)
29
-
23.[Write a program to store values in to a map](#Q23)
30
-
24.[Write a code to iterate over a set](#Q24)
31
-
25.[Write a code to iterate over a map](#Q25)
32
-
26.[Show how map is different from object to store key value pairs with coding example](#Q26)
33
-
27.[Write the code to remove the duplicates from the array](#Q27)
34
-
28.[Design a flat function which flattens an array to any depth](#Q28)
35
-
29.[Check if all the students of have passed or not (40 is the pass marks)](#Q29)
36
-
30.[Get the average of all the salaries which is greater than 10000 from the department of "IT" from the array of objects)](#Q30)
37
-
31.[Extract the list of all the elements from the list of numbers given in 2 arrays](#Q31)
38
-
32.[Get the list of all distinct elements which are present in both list of numbers](#Q32)
39
-
33.[Extract list of elements present only in the first list given.](#Q33)
40
-
34.[Create a function named "average" which can calculate the average of an array and should be available to be called from any Array object.](#Q34)
41
-
35.[Write a program to polyfill `filter` functionality of the Array](#Q35)
42
-
36.[Write a program to polyfill `map` functionality of the Array](#Q36)
43
-
37.[Write a program to polyfill `reduce` functionality of the Array](#Q37)
44
-
38.[Write a code to eliminate duplicate objects in an array where each object has an 'id' property which can be used to identify the object and the duplicate object with lower rank to be removed](#Q38)
45
-
39.[Create an array which will only accept string values. (Homogeneous array of strings)](#Q39)
46
-
40.[Create a Proxy object through which the array can be accessed as usual but also allow to access the values through negative indices](#Q40)
17
+
11.[Sort the given array of objects in ascending order according the authors lastname](#Q11)
18
+
12.[Square all the positive numbers of the array and return the output array](#Q12)
19
+
13.[Write a code to generate an array with range of numbers and shuffle them](#Q13)
20
+
14.[Check if the user with the name "John" exists in the array of objects](#Q14)
21
+
15.[Generate an array of objects with properties id and full name from an array of objects where each object will have id, firstname and lastname](#Q15)
22
+
16.[Create an array by removing all the holes of the array](#Q16)
23
+
17.[Write a program to calculate the sum of all the values of an array](#Q17)
24
+
18.[Get the maximum value from a numbers array along with its index](#Q18)
25
+
19.[Find the number of occurences of minimum value in the numbers list](#Q19)
26
+
20.[Create an array of length n with all the values of it set to 10](#Q20)
27
+
21.[Optimize the given statements having lot of logical checks to use a compact and cleaner logic](#Q21)
28
+
22.[Write a program to iterate over a 2 dimensional array and print all the values of it](#Q22)
29
+
23.[Write a program to store values in to a set](#Q23)
30
+
24.[Write a program to store values in to a map](#Q24)
31
+
25.[Write a code to iterate over a set](#Q25)
32
+
26.[Write a code to iterate over a map](#Q26)
33
+
27.[Show how map is different from object to store key value pairs with coding example](#Q27)
34
+
28.[Write the code to remove the duplicates from the array](#Q28)
35
+
29.[Design a flat function which flattens an array to any depth](#Q29)
36
+
30.[Check if all the students of have passed or not (40 is the pass marks)](#Q30)
37
+
31.[Get the average of all the salaries which is greater than 10000 from the department of "IT" from the array of objects)](#Q31)
38
+
32.[Extract the list of all the elements from the list of numbers given in 2 arrays](#Q32)
39
+
33.[Get the list of all distinct elements which are present in both list of numbers](#Q33)
40
+
34.[Extract list of elements present only in the first list given.](#Q34)
41
+
35.[Create a function named "average" which can calculate the average of an array and should be available to be called from any Array object.](#Q35)
42
+
36.[Write a program to polyfill `filter` functionality of the Array](#Q36)
43
+
37.[Write a program to polyfill `map` functionality of the Array](#Q37)
44
+
38.[Write a program to polyfill `reduce` functionality of the Array](#Q38)
45
+
39.[Write a code to eliminate duplicate objects in an array where each object has an 'id' property which can be used to identify the object and the duplicate object with lower rank to be removed](#Q39)
46
+
40.[Create an array which will only accept string values. (Homogeneous array of strings)](#Q40)
47
+
41.[Create a Proxy object through which the array can be accessed as usual but also allow to access the values through negative indices](#Q41)
47
48
48
49
---
49
50
@@ -333,6 +334,32 @@ If function is not passed an argument, default sorting will happen
333
334
<br />
334
335
335
336
#### Q11
337
+
### Sort the given array of objects in ascending order according the authors lastname
### Extract list of elements present only in the first list given.
816
843
817
844
- The only present elements of 1st list will be the result when all the elements of 1st list not present in the 2nd are chosen
@@ -827,7 +854,7 @@ Elements of 2nd list only can be obtained by checking for all the elements of li
827
854
828
855
<br />
829
856
830
-
#### Q34
857
+
#### Q35
831
858
### Create a function named "average" which can calculate the average of an array and should be available to be called from any Array object.
832
859
833
860
- The function added to Array prototype are accessible to all the objects of Array
@@ -845,7 +872,7 @@ Array.prototype.average = function (){
845
872
846
873
<br />
847
874
848
-
#### Q35
875
+
#### Q36
849
876
### Write a program to polyfill `filter` functionality of the Array
850
877
851
878
- `filter` iterates over the all values of array and passes value, index and array (itself) as the arguments
@@ -875,7 +902,7 @@ The solution is a simple polyfill of `filter` and not intended to handle all the
875
902
876
903
<br />
877
904
878
-
#### Q36
905
+
#### Q37
879
906
### Write a program to polyfill `map` functionality of the Array
880
907
881
908
- `map` iterates over the all values of array and passes value, index and array (itself) as the arguments
@@ -902,7 +929,7 @@ The solution is a simple polyfill of `map` and not intended to handle all the co
902
929
903
930
<br />
904
931
905
-
#### Q37
932
+
#### Q38
906
933
### Write a program to polyfill `reduce` functionality of the Array
907
934
908
935
- `reduce` iterates over the all values of array and passes value, index and array (itself) as the arguments
@@ -928,7 +955,7 @@ The solution is a simple polyfill of `reduce` and not intended to handle all the
928
955
929
956
<br />
930
957
931
-
#### Q38
958
+
#### Q39
932
959
### Write a code to eliminate duplicate objects in an array where each object has an 'id' property which can be used to identify the object and the duplicate object with lower rank to be removed
0 commit comments