How to know if the MODEL value is a file?

Asked

Viewed 30 times

-1

I need to know if the value that is in a screen MODEL property is a file. How could I do this in javascript?

Model

  • Please explain better because your question is very vague.

1 answer

2


You can check this using the instanceof!

let bn_escudi_time = new File(['arr1', 'arr2', 'arr3'], "file.txt");
let string = 'string';

console.log(bn_escudi_time instanceof File); // -> true
console.log(string instanceof File); // -> false

Browser other questions tagged

You are not signed in. Login or sign up in order to post.