[英]can't understand some javascript code : javascript
I am newbie in javascript and i need some help please my goal is to convert a csv file to an ofx , I have found an open source and i want to understand it to modify it as my requirements,我是 javascript 的新手,我需要一些帮助,我的目标是将 csv 文件转换为 ofx,我找到了一个开源,我想了解它以根据我的要求对其进行修改,
this is the function in javascript:这是javascript中的函数:
// csv to ofx
function convert(csvData, filename) {
csvData = csvData.split('\n').map(row => row.trim())
csvDataInfoRow1 = csvData[0].split(';');
csvDataInfoRow2 = csvData[1].split(';');
csvDataInfoRow4 = csvData[3].split(';');
// the date at the end of the period
let dateEnd = csvDataInfoRow1[3].substr(csvDataInfoRow1[3].length - 10).split('/');
// the date at the beginning of the period
let dateBeginning = csvDataInfoRow1[2].substr(csvDataInfoRow1[2].length - 10).split('/');
My Question is why the programmer add just 3 variables:我的问题是为什么程序员只添加 3 个变量:
csvDataInfoRow1 = csvData[0].split(';');
csvDataInfoRow2 = csvData[1].split(';');
csvDataInfoRow4 = csvData[3].split(';');
and not more or less varibles like that , what i mean for example why he just stopped in csvDataInfoRow4 = csvData[3].split(';')
and what he want to do by this instruction !;而不是这样的或多或少的变量,我的意思是例如为什么他刚刚停在
csvDataInfoRow4 = csvData[3].split(';')
以及他想通过这条指令做什么!; also why for example he did'nt complete another variable like : csvDataInfoRow5 = csvData[4].split(';')
and so on ...还有为什么例如他没有完成另一个变量,例如:
csvDataInfoRow5 = csvData[4].split(';')
等等......
也许代码仅适用于三行 CSV
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.