Javascript match prefix

const hostname = "www.someaddress.com"
console.log(!!hostname.startsWith('www.') ? 'matching' : 'not matching')

Leave a Reply