My scenario, I am trying to remove array of string value duplication and print only unique value of index. For example:
const numbers = [
"3445612712345678",
"3445613787654321",
"3445615712345678",
"3445618787654321",
];
var uniqueValue = numbers.filter((v, i, a) => a.indexOf(v) === i);
console.log(uniqueValue);
If you seen, my array of string values first 5 characters are same for all index then next two values will be changing but after those two from 8th position of string values are matching one to one, here I have to do matching from 8th position to till end then need to print unique index of values.
[
"34456 12 712345678", // Same(1) 712345678 // Add
"34456 13 787654321", // Same(2) 787654321 // Add
"34456 15 712345678", // Same(1) 712345678 // Remove
"34456 18 787654321", // Same(2) 787654321 // Remove
];
Expected out: //according to 8th string position to till end string char position check and need to remove duplicates.Because first five numbers are static then 6th and 7th position numbers are dynamic but no need to consider this for get unique. From 8th to till end position numbers only comparable with each other, based on it we have to get unique value.
[
"3445612712345678",
"3445618787654321",
];