Find list of strings that matches a pattern that start with a special character « and end with a special character »

You can match using unicode and replace the unicodes later Unicode finder let str = `«Name» has an account on the bank «Bank Name»` let final = str.match(/\u00AB.*?\u00BB/gu).map(v=>v.replace(/\u00AB|\u00BB/g,”)) console.log(final) Alternatively you can use exec and get the value from captured group let str = `«Name» has an account on the bank «Bank Name»` let final … Read more

Attaching Dynamic Variable in ES6 [closed]

This is not correct usage of find in array. Look at the sample: products = [“vegetable”, “food”, “test”]; const productValue = 1; var res = products.find((item => console.log(item))); Now look at this one: products = [“vegetable”, “food”, “test”]; const productValue = 1; var res = products.find((item => console.log(item[1]))); See you are using “vegetable”[1] that is … Read more