Why I can’t exit the Fullscreen using esitFullscreen method?

Whenever I try to exit the Fullscreen in the console it shows that exitFullscreen is not a function

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

  <button onclick="o()">O</button>
  <button onclick="x()">X</button>
<script type="text/javascript" charset="utf-8">
  function o(){
   function x(){


From the code above by clicking on button x I should exit Fullscreen but it is not happening


Look at the documentation.

requestFullscreen is a method on elements

exitFullscreen is a method on the document