tryingtolearn Posted March 16, 2015 Share Posted March 16, 2015 Im following some examples for drag and drop file uploads and have come across the same for loop in different tutorials And get the following error (jslint) The loop for (i = 0, f; f = files[i]; i++) { ParseFile(f); UploadFile(f); } The error Expected a conditional expression and instead saw an assignment I tried omitting it and adding a break in the loop but it gave the same error on the break line. Trying to figure out an explanation for the error - or a way to re write the second statement to pass through jslint Quote Link to comment https://forums.phpfreaks.com/topic/295285-drag-and-drop-jslint-error/ Share on other sites More sharing options...
tryingtolearn Posted March 16, 2015 Author Share Posted March 16, 2015 (edited) This seemed to do the trick Not exactly sure what throws the error above or why its considered an error since both versions work.. // file selection function FileSelectHandler(e) { var i, files, f; // cancel event and hover styling fileDragHover(e); // fetch FileList object files = e.target.files || e.dataTransfer.files; // process all File objects for (i = 0; i <= files.length - 1; i = i + 1) { f = files[i]; parseFile(f); uploadFile(f); } } Edited March 16, 2015 by tryingtolearn Quote Link to comment https://forums.phpfreaks.com/topic/295285-drag-and-drop-jslint-error/#findComment-1508240 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.