I am trying to find a way around using spaces and hyphens in a javascript statement.
<script type='text/javascript'>
<!--
var {word} = '{word}';
if(
{word} == 'hellothere' ||
{word} == 'hello there' ||
{word} == 'hello-there'
){
document.write('blah blah');
}
else {
document.write('');
}
</script>
The above code is designed so that whenever the word is hello there
a certain thing is displayed.
However, it doesn't work when there is a space between the words: hello there
.
I tried using a hyphen: hello-there
but that doesn't work either.
It only works when I write as one word: hellothere
or HelloThere
for better reading.
Why is this? And are there ways around it?