0

I m trying to picture this or trying to understand this but have a question whose answers i cannot find

const csv_to_array = (data, delimiter = ',', omitFirstRow = false) =>

    .slice(omitFirstRow ? data.indexOf('\n') + 1 : 0)
    .split('\n')
    .map(v => v.split(delimiter));//Please explain this v thing thats confusing for me

console.log(csv_to_array('a,b\nc,d')); 

Please help me in this case

  • @GetSet - The data is in the last line of the code block. – Quentin Mar 28 '20 at 17:47
  • You have 5 different questions. Ask **one** question. And be sure to google it before posting it. But this is a very straightforward function: it takes a string of data in csv format, with a delimiter that defaults to comma, and whether or not to slice off the first row (e.g. for the column names). It splits the csv into an array of lines on the \n character, then splits the lines on the delimiter to give you a 2D array of the values themselves. – Jared Smith Mar 28 '20 at 17:49

0 Answers0