const parentElement = document.getElementById("parent");
const firstChild = parentElement.firstElementChild;

console.log(firstChild); // 첫 번째 자식 요소 객체를 출력합니다.
element.firstElementChild
<div id="parent">
    <p id="first-child">첫 번째 자식 요소입니다.</p>
    <p id="second-child">두 번째 자식 요소입니다.</p>
</div>
const parentElement = document.getElementById("parent");
const firstChild = parentElement.firstElementChild;

// 첫 번째 자식 요소 객체를 반환합니다.
console.log(firstChild); // <p id="first-child">첫 번째 자식 요소입니다.</p>
<div id="parent">
    자식 요소는 없고 텍스트 노드만 있습니다.
</div>
const parentElement = document.getElementById("parent");
const firstChild = parentElement.firstElementChild;

// 자식 요소가 없을 경우 null을 반환합니다.
console.log(firstChild); // null
<ol id="fruits">
    <li>사과</li>
    <li>바나나</li>
    <li>복숭아</li>
</ol>
<button type="button">첫 번째 자식 요소 글자 색상 변경</button>
const fruitList = document.getElementById("fruits");
const firstChild = fruitList.firstElementChild;
const button = document.querySelector("button");

button.addEventListener("click", () => { // 버튼 클릭 이벤트
    // 첫 번째 자식 요소의 텍스트 색상을 빨간색으로 변경
    firstChild.style.color = "red";
});
실제 적용된 모습 '버튼'을 실제로 클릭해 보세요!