I am trying to assign a variable to a parameter obtained by the function:
function listResults(entries) { var gStr = ''; var file_i = 0; var dir_i = 0; entries.forEach(function(entry) { if (entry.isDirectory) { //gStr += 'dir_' + dir_i + '=' + entry.name + " "; //dir_i++; } else { /***last modificated date*/ var lastFileModDate = function(metadata) { //console.log("Last date: " + metadata.modificationTime); modificationTimes += metadata.modificationTime; } /**file size*/ var fileSize = function(file) { //console.log("File size: " + file.size); fileSizes += file.size; } modificationTimes = entry.getMetadata(lastFileModDate, fail); fileSizes = entry.file(fileSize, fail); gStr += 'file_' + file_i + '=' + entry.name + ' date_file_' + file_i + '=' + modificationTimes + ' file_size_' + file_i + '=' + fileSizes + " | "; file_i++; } }); }
she again becomes undefined
. What can be done so that it does not lose data?
Here is even an example of the output displays undefined http://jsfiddle.net/vL5nF/ why so?
var a; var p = function(m) { a = m + 2; } document.write(p(3));
For those who are too lazy to follow the link
return
'a? return a = m + 2; and you will have a normal result, but when you already understand that simply asking unintelligible questions on this or any other resource, you cannot understand what is happening in your scripts - Specter