I'm trying to learn some Javascript. I've written this code where it should return a, b, c, d and if the letter a is in the var letters, it should alert the message "Yes it is true".
When I run the code it doesn't return me anything.
Can anyone see why?
<script type="text/javascript">
var letters = ["a", "b", "c", "d"]
var numbers = ["one", "two", "three", "four"]
for(x=0; x < letters.length; x++) {
document.write(letters);
if(a in letters) {
document.write("Yes it is true");
}
}
</script>