how to extract dynamic variable from 3c 3e bracket in javascript

Solutions on MaxInterview for how to extract dynamic variable from 3c 3e bracket in javascript by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to extract dynamic variable from 3c 3e bracket in javascript"
Leonie
20 Oct 2020
1let pattern = "/used-cars/<city_name>/<location>/<car_name>-cars-for-sale"
2let matches = pattern.match(/<.+?>/g);
3const newArray = matches.map((match) => match.replace(/[<>]/g, ''));
4let object = {};
5newArray.map((item, index) => {
6  object[item] = '';
7});
8console.log(object)
9
similar questions