Javascript

Could you demonstrate how to code a function in JavaScript that finds the immediate left sibling of a given DOM element?

Did you come across this question in an interview?

Interview question asked to Frontend Engineers interviewing at Sophos, Careem, Broadcom and others: Could you demonstrate how to code a function in JavaScript that finds the immediate left sibling of a given DOM element?.