Skip to main content
deleted 10 characters in body
Source Link
Akk3d1s
  • 246
  • 3
  • 9

If you only want to test for primitive values that has the same order, you can try:

if(JSON.stringify(arr1.sort()) !== JSON.stringify(arr2.sort())) { console.log('invalid'); } 

If you only want to test for primitive values that has the same order, you can try:

if(JSON.stringify(arr1) !== JSON.stringify(arr2)) { console.log('invalid'); } 

If you only want to test for primitive values, you can try:

if(JSON.stringify(arr1.sort()) !== JSON.stringify(arr2.sort())) { console.log('invalid'); } 
Source Link
Akk3d1s
  • 246
  • 3
  • 9

If you only want to test for primitive values that has the same order, you can try:

if(JSON.stringify(arr1) !== JSON.stringify(arr2)) { console.log('invalid'); }