Is there a shorthand for the following -
if(tld == "com" || tld == "net" || tld == "co" || tld == "org" || tld == "info" || tld == "biz") { //do something; }
you could use an array
if(["","com","net","co","org","info","biz"].indexOf(tld) > -1) { // do something }
or if you are using jquery :
$.inArray(tld, ["com","net","co","org","info","biz"])
REF - Performance of OR operation ( || ) vs inArray()
1.4m articles
1.4m replys
5 comments
56.9k users