Application In PDF/JavaScript
I am trying to print the dollar values only from the array. Tried the following and I am not sure If I am using the correction functions or not.
var pdts = ['Apple*Fruits-$58.9', 'Orange*Fruits-$60.5'];
var arr = pdts.toString().split('-');
console.log(arr[2]);
console.log(arr);
Current Output:
$60.5
Expected output in different lines:
$58.9
$60.5
Please help
You need to loop over the array, not convert the array to a single string.
var pdts = ['Apple*Fruits-$58.9','Orange*Fruits-$60.5'];
result = pdts.map(pdt => pdt.split('-')[1]).join('\n');
console.log(result);