Detect if JavaScript object is a FormData instance

Use instanceof

For example:

let formData = new FormData()
let time = new Date()

console.log("statement: formData is a FormData instance", formData instanceof FormData) // statement is true
console.log("statement: time is a FormData instance", time instanceof FormData) // statment is false

Source

Leave a Comment

tech