I have my JSON data from API stored in map now one of its data is named with URL and contains URL of the sites I have to check whether the URL contains a particular string or not so that I can apply different styling to the div on HTML
let x = `${ values.url }`;
if (x.contains("codeforces")) {
console.log("Yes");
}
I am getting error while using this:
Please help me with this.
I think you want to use includes function. There is no function called contains
let x = values.url;
if (x.includes("codeforces")) {
console.log("Yes");
}
Let me know if it helps :)