for (var i = 0, f; f = file[i]; i++) 

This code is responsible for displaying the number of files, now it can output at least 100 or 200 files without restrictions, but what needs to be changed in it so that it displays no more than 10 files?

    1 answer 1

     for (var i = 0, f; i < 10 && f = file[i]; i++) 

    And even better - do it humanly.

     var cnt = Math.min(10, file.length); for (var i = 0, i < cnt; i++) { var f = file[i]; ....... } 
    • min can still? :) - teran
    • @teran yes. - Anton Shchyrov
    • I tried that and that code, but for some reason it doesn't output anything at all - AsXK
    • @AsXK And what should output? What is your file ? Is it an array or some object? How do you get it? - Anton Shchyrov