I was looking for a way to check if an object is a FormData instance, similarly to Array.isArray()
Edit: If someone knows about instanceof
, they obviously won't need to be pointed to instanceof
. Obviously not a duplicate.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With