 In the first video of this course, we wrote this csv file which contain some patient information. So here as you can see that this csv file is just a simple plain text file containing comma separated values. Now have you ever tried to read csv files using javascript? Yes? No? No problem. In this video, we will be going to learn how to read a csv content using javascript. Now before we start, let me tell you one thing. This video is going to be very interesting for you. So watch it till end. Okay, so are you ready to write some code? Alright, let me copy this two row from this csv file and paste it over here in this script tag but into one variable. So let me define the variable. Now here one thing you note that I have pasted csv content inside this back tick. This is not a single code. This is called template literals. Template literals can be used to represent multi-line strings and there are some other use case also of it. Alright, so now let's do the console.log of this variable and now when I save this file, you can see our csv content in the browser console log over here. Okay, now if I split this content with new line character using split function like this and let me save the file. Okay, so as you can see here that it displays each line in array object. So now here our overall goal is to iterate through each line of this data and display csv header as column and their respected value in table format using browser console. So to achieve this requirement, we have to insert csv header as key and csv row data as value in one array object. So for that, let me define one array object over here and let me get this line array object in one variable. Let me remove this line. Now let's take off the first line to get the headers then split into an array using comma. So now the array object of csv header are resided into this variable. Now let's iterate through remaining rows using for loop. Now in this for loop one thing you note that I initialize the I variable with one instead of zero because now we don't need the header row here. We only want to iterate through our row data. So let me define the row data over here and split it with comma. Now let's initialize this array as empty object to store our actual data. Okay, and then to iterate through our actual patient record, we need another for loop. So let me define the another for loop over here. And now let us do the console.log of our csv header and csv row data headers of J. But rather than this, let's display this record as key colon value. So for that, let me remove this last console.log. Now to display this header as key colon row data as value, let us use string interpolation feature of JavaScript using back tick dollar curly brace curly brace and again dollar and complete the back tick. Now let us save this file and see our output in console.log. So yes, as you can see that we get our data as expected. This is our header and this is our row value. All right. Now so far so good. Now let's insert this csv data into this array object where this csv header would be insert as a key and this row data as values. So for that equal to row data of J. Now let me comment this line. Now at the end of this loop, let us do the console.log of this array object. And now if I save this file, we will get our expected data into an array. Now here is the interesting part. Do you know that this console.log is not limited to logging of our data? It can also display our array object data in tabular format. Yes. So for that, what you need to do is instead of using this console.log, here you just need to use table. Now let me save the code and here we go. It started displaying our csv data into pure table format and you can also see the original array below this table like this. Now let me open our original csv file to compare this data. So here is our first row which is displayed over here and this is our second row which is displayed over here. Okay so this is how you can read csv data using JavaScript.