Click here to Skip to main content
15,887,454 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
var txtFile=new File("CustomerDetails.txt",3);
if(txtFile!=-1)
{
cdata=cname+","+cdob;
fwrite(txtFile,cdata);
fclose(txtFile);
}
it give an error
TypeError : Failed to construct 'File': The provided value cannot be converted to a sequence.

What I have tried:

var txtFile=new File("CustomerDetails.txt",3);
if(txtFile!=-1)
{
cdata=cname+","+cdob;
fwrite(txtFile,cdata);
fclose(txtFile);
}
Posted
Updated 29-Jan-20 4:49am
v2
Comments
jimmson 29-Jan-20 8:42am    
So.. JavaScript or Java? Those are not the same!

1 solution

If you are using File.File() - Web APIs | MDN[^], then you are using it wrongly. The first argument must be a sequence, see the provided code sample.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900