I want to change the extinsion of .doc to .txt.
alert(myvar) show empty alert.
enter code here
<form>
<input type="file" id="f1">
<button onclick="myFunction(f1.value)">Try it</button>
</form>
<script>
function myFunction(a) {
var mystr = a;
var myarr = mystr.split(".doc");
var ex= ".txt";
var myvar = myarr + ex;
alert(myvar);
}
</script>