Posts

Showing posts with the label deep

javascript : Object .equals(Object)

  javascript : Object .equals( Object ) Target: Applicable with any javascript  Object  . Description : It compare two javascript object, array, dom element, json object, class object, date object, etc. in depth and compare its property value and return true/false whether both object structure and values are same. It is recursive method so it compare deep in object property. Note: If both object structure is same and holding same property value then it return  true  otherwise  false . Syntax: Object .equals (Object) return  true/false  by comparing values of every property of objects. Usase: var arr1 = [1,2,3,4,5]; var arr2 = [1,2,3,4,5]; arr1.equals(arr2); It return  true . while arr1==arr2 return false var arr1 = [1,2,3,4,5]; var arr2 = arr1.clone(); arr1.equals(arr2); It return  true . while arr1==arr2 return false var arr1 = [1,2,2,4,5]; var arr2 = [1,2,3,4,5]; arr1.equals(arr2); It return  false var d1 = new Date('1/Jan/2020');...