How js filters the dates I want within the date range.

problem description

arr1 = ["2018-11-04," 2018-11-07, "2018-11-11," 2018-11-13]

arr2 = [2018-11-04, 2018-11-06, 2018-11-07, 2018-11-010, 2018-11-11, 2018-11-12, 2018-11-13, 2018-11-14]

2018-11-03, 2018-11-04, 2018-11-06, 2018-11-07, 2018-11-09, 2018-11-010, 2018-11-11, 2018-11-11, 2018-11-11, 2018-11-11, 2018-11-11, 2018-11-13, 2018-11-14, 2018-11-13, 2018-11-14, 2018-11-13, 2018-11-14]

the environmental background of the problems and what methods you have tried

choose the rest of arr1 from arr2

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Nov.09,2021

arr2 removes what is included in arr1, right?

arr2.filter(function(obj){return arr1.indexOf(obj)==-1})

if it is included, it is greater than -1

Menu