How to trim unwanted fields in a JavaScript object? : For example, I have

    const eva = {name: "Eva", age: 3, hobby: "dance", state: "NY"};
    const ann = {name: "Ann", age: 9, hobby: "read", state: "WA", schoolyear: 3};

I want to have a trim function, which only keeps the fields I want.

    cosnt fields = ["name", "age", "state"]

and the output will be

    const eva2 = {name: "Eva", age: 3, state: "NY"};
    const ann2 = {name: "Ann", age: 9, state: "WA"};

Thanks!