I have a JavaScript problem that I've been trying to solve, and I could really use some help.

My goal is to find the first and last day of a given year in JavaScript. I have a date object representing the year, and I want to extract the first and last day as separate date objects. Here is my code.

<script>
const year = new Date('2023');
// Now I want to find the first and last day of this year
</script>

Can anyone guide me on how to achieve this?