let arr = [ 1, "Computer Science", 5, "Computer security", 6, "Graphic design", 4, "Programming language", 3, "Software engineering", 2, "Web Designing", ]; let matchName = "Computer Science"; let num = 0; arr.map((ele) => { ele == matchName ? num++ : "none are match"; }); num > 0 ? console.log("item are already in the array") : console.log("item are not mathced");
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter