Im using Hugo and Im trying to pass a markdown parameters from md file to JavaScript file.
Are you using your own theme, or something you have downloaded?
You can edit the relevant template to output the parameter as a Javascript variable. And after that, use a Javascript function to reference that variable by name. Example:
<script type="application/javascript">
var title = "{{.Title}}"
console.log(title)
</script>
In this case, you would probably want to add a check to ensure that parameter exists, or is properly set before trying to print it. Otherwise the JS may throw an error if the variable is null or undefined.
Hugo is a static website generator - so it outputs HTML - if you want a "variable" from markdown to Javascript - with traditional JS and Markdown (i.e. no products like Alpine or something beyond the scope of Hugo) you would output the HTML and have Javascript - getElementbyID for instance.