I'm new to Javascript and coding, so this is likely basic knowledge, but this example works, despite having no semicolons in a function for the if/else statements, or even curly braces {}. I thought they were both needed if you had multiple conditions within an if/else. Two have single conditions, so I understand they wouldn't need both semicolon and curly brace, but this has neither. And the else statement has 2 conditions, still no semicolon or curly brace and yet the code still works. Thanks for any insight.
This other question (that was closed but answered - Why is it that semicolons are not used after if/else statements?) had notes addressing the use of ; or {} but did not address if the syntax requirement somehow changes for if/else within a function.
http://www.javascriptkit.com/howto/show2.shtml
<script type="text/javascript">
//variable that will increment through the images
var step=0
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return document.getElementById('slide').src = slideimages[step].src
if (step<2)
step++
else
step=0
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",2500)
}
slideit()
</script>