How would you identify a matching node in DOM tree B, given a node from an identical DOM tree A?

Free for the first 3 answer contributors

Interview question asked to Frontend Engineers interviewing at Meta, GoDaddy, Toshiba and others: How would you identify a matching node in DOM tree B, given a node from an identical DOM tree A?.