Console log not showing the attribute

I am using below HTML for my code.

  <body>
    <div id="myId" class="oldClass">
      This is the original content of the element with ID "myId".
    </div>
  </body>

I am perform DOM Manipulation using below JavaScript Code:

const myElement = document.getElementById('myId');

myElement.setAttribute('data-example', 'value');
console.log(myElement);
myElement.removeAttribute('data-example');
console.log(myElement);

However, first console.log() statement is not displaying the data-example property.

<div id="myId" class="oldClass">
      This is the original content of the element with ID "myId".
    </div>