Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>The Element Object</h1> <h2>The hasAttributes() Method</h2> <p>The body element has attributes:</p> <p id="demo"></p> <p>Adding an attribute to the body element, and the result will be true.</p> <script> let answer = document.body.hasAttributes(); document.getElementById("demo").innerHTML = answer; </script> </body> </html>