Window.value for global variable is not working

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Practice@1</title>

<script type="text/javascript">

</script>
<input type="button" value="click" onclick="me()"/>
<script>

    document.write("i am no bpody");

    function me(){

        document.write("i am on");

        window.value=3;

    }

    function area(){

        var Area=5*5;

        document.write(Area);

    }

    area();

    document.write(window.value);

   

</script>

> Preformatted text

It is the concept of Global and Local Scope .Your variable window.value is in the block/ local scope of me(), you cannot get it from outside.

Any inner function can access outer value but from outside you cannot access inner value of functions.

Two ways to get your value:
you can access by placing your window.value in global scope or
you can pass your inner value window.value to any global variable to access inside/outside of function.