Skip to content
Advertisement

Check the element length to flag status boolean

I am assigning as default checked false in this return Object, see the code

JavaScript

I have an exception, in case it is my first file dropped i want checked: true,

I know that my first file dropped is when

const filePosition = files.length returns 0,

how can i apply this condition in my checked?

Advertisement

Answer

If I understand correctly, you want to updated checked to true if file.length === 0 and false and file.length !== 0

If that is correct, you can just do:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement