Respected sirs,
I have a 2 column table with more than 40 rows. 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 80
Being new to JS , I could find the way as given in look up
object for finding a value in reverse alphabet .
However for that I have to type all the 80 rows data as an object.
for example.
function pensionLookup(val) {
var result ;
// Only change code below this line
var lookups ={
40:
15,
50:
14,
60:
13,
70 :
12,
80:
10
}
result = lookups[val]
// Only change code above this line
return result;
}
console.log(pensionLookup(70)); //12
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:
- Whether my approach is correct or not if I don’t want to use XL. lookup; I have to use ‘result’ further to calculate the commuted value of Pension.
- what are other ways to tackle this.
- any other advice welcome.
regard