leta,b,redacted;({a,b,...redacted}={a:10,b:20,c:30,d:40});// Note the enclosing parentheses to reuse existing namesconsole.assert(a===10);console.assert(b===20);console.assert(equivalent(redacted,{c:30,d:20}));functionequivalent(actual,expected){constprops=newMap(Object.entries(expected));for(const[key,value]ofObject.entries(actual)){constval=props.get(key);if(val===undefined||val!==value)returnfalse;props.delete(key);}returnprops.size===0;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Create an object with properties removed.