# Page Local Variable

We need to define some functions and variables which are page specific, you can not do that by simply defining it. Because simply defining variables will not work as variable among different methods and tags in Yugal can not be accessed. Example: `function` or `variable` or `constant` defined or used in `willmount` lifecycle method can not be accessd from `didmount` or `body.`

This is because you need to define your variable in `page` object, and call it from there. Your variables and methods will be cleared whenever the page is changed.

Example

```php
<?php
return <<<HTML
    <body>
        <button onclick="page.dothis();">CLICK ME BRO!</button>
    </body>
    <script use="willmount">
        page.dothis = () => {
            console.log('I DID THIS!');
        };
    </script>
HTML;
?>
```
