I have a piece of code that I have written which shows a word when I use a specific tag:
<script type='text/javascript'>
var {type} = '{type}';
if ({type} == 'football'){
document.write('football');
}
</script>
The above will output the word 'football'.
I can manipulate it to include various words:
<script type='text/javascript'>
var {type} = '{type}';
if ({type} == 'football' || {type} == 'womensfootball'){
document.write('football');
}
</script>
Use of either tag will render the output word 'football'.
However, how would I amend it to not duplicate the output for when I use multiple tags?
For example, using the above piece of code. I want to post something and use both the 'football' and 'womensfootball' tags without getting the output twice - which is currently what happens. Do I need to add another function or maybe use an alternative to ||
?
Additionally, is there a way I can use a hyphen in the or a space?
e.g.
{type} == 'womens-football' || {type} == 'womens football'
Thanks.