Problem with function in DOM

Hello Fellow Members!

I’m Rahul and I’m new to coding. I have a query related to onclick() event. Please look at the following code snippet -

let door1 = document.getElementById('one');
door1.src = "closed_door.svg";
const isClicked = (door) => {
    if(door.src === "closed_door.svg") {
        return true;
    else {
        return false;
door1.onclick = () => {
    if(isClicked(door1)) {
    door1.src = "beach.svg";}

It’s my attempt of doing ChoreDoor project from DOM events lesson. To give you brief, one is an id for an element. Without isClicked, I am able to successfully change the src from closed door to beach on clicking. But when I introduce isClick, it doesn’t change. Can someone please tell me what I’m missing. I’ll be very thankful