Java script alternative to LookUp function in excel

Respected sirs,
I have a 2 column table with more than 40 rows of data is arranged as under.

column 1            column2
head-AGE          Pension value
40                        15
41                       14.90
42                        14.45
43                         14.10

and so up to AGE -80.
Being new to JS , I need find the way search for AGE say 70 corresponding value in column2.as like lookup function in excel.
I tried for finding a value in a example as given below…
However for that I have to type all the 80 rows data as an object.
for example.

function pensionLookup(val) {
var result ;
var lookups ={ 
  40:
  15,
  
 50:
 14,
    
 60:
 13,
    
 70 :
 12,

 80:
 10
}
result = lookups[val]
return result;
}
console.log(pensionLookup(70)); //12

but for that I have to type manually all the rows data from excel table as given above.
I shall be highly thankful if I am advised:

  1. Whether my approach is correct or not if I want to use javascript instead of XL. lookup; I have to use ‘result’ further to calculate the commuted value of Pension.
  2. what are other ways to tackle this.
  3. what if the data is 1000 rows.
  4. any other advice welcome.
    regard

|

You need to search how to read (or parse) CSV files with JavaScript. I found a couple (link 1, link 2)

The real question is: why use JavaScript for this? Wouldn’t it be simpler to use Python? CSV File Reading and Writing