Using FormData in scripts


I’m getting an error when I try to use create a Javascript FormData object in preparation for posting to an API. I would have thought FormData would have been well supported.

console.log(`Hello, ${}!`);
const endPoint = new URL('');
const formData = new FormData();
formData.append("user", 'tom');

const response = await fetch(endPoint.toString(), {
    method: "POST",
    body: formData,


Getting an error saying that FormData is not defined