Question: I am working in a custom module for admin section and used to add a third party JS file in my layout and saved JS file in `magento2\app\code\[Namespace]\[Module]\view\adminhtml\web\js\JSFILE.js`

Now, at other part of my custom module in `Block` section i need to access that file, and need to use `JS file path`. How should i get the full path included.

**Example:**
`http://localhost/magento2/pub/static/adminhtml/Magento/backend/en_US/Namespace_Module/js/jsfile.js`

The above given path i need to get dynamically.

any help is appreciated.

Answer: 
You can simply call it inside your view file,

```
<?php echo $block->getViewFileUrl('Namespace_Module::js/jsfile.js'); ?>

```
Add `requirejs-config.js`

```
var config = {
map: {
    '*': {
        libjs: 'VendorName_ModuleName/js/JSFILE'
    }
}

```

};

In Block class can get url js like this way

```
public function DoSomeThing(){

    return $this->_storeManager->getStore()->getBaseUrl(
            \Magento\Framework\UrlInterface::URL_TYPE_MEDIA
        ).'libjs/js/JSFILE.js';
}

```

In Template file

```
<script type="text/javascript">
require([
   'jquery',
   'libjs',
   'domReady'
],function($){
    // function dosome(){}
    // Js code
});
</script>

```