-
JSON.stringify() 사용
a1 = [11,22] a2 = [11,22] a1 === a2 //false JSON.stringify(a1) === JSON.stringify(a2) //true
Array.filter()사용
a1 = [11,22] a2 = [11,22,33] a1.filter(x => a2.includes(x)) //교집합(intersection) 결과: [ 11, 22 ] a1.filter(x => !a2.includes(x)) //차집합(difference) 결과: [] a2.filter(x => !a1.includes(x)) //차집합(difference) 결과: [33]
'Html Css JavaScript' 카테고리의 다른 글
Nullish coalescing assignment (0) 2023.02.20 Spread syntax (...) (0) 2023.02.14 Babel (0) 2023.01.29 Javascript UMD (Universal Module Definition) (0) 2023.01.29 Javascript AMD (Asynchronous Module Definition) (0) 2023.01.29 Javascript ESM (ECMA Script Module) (0) 2023.01.29 Javascript CJS (CommonJS) (0) 2023.01.29 ECMAScript, ECMA-262 (javascript) (0) 2023.01.29