Correct syntax for alert method

Correct syntax for alert method

Hi

I came across this code for the setting an alert:

setTimeout(function(){
 alert('This is an alert!')},1000 );

However when i tried this code it also worked:

 setTimeout(function(){
alert('This is an alert!',1000);
});

The difference in syntax is highlighted fuchsia color.

I would like to know, What is the correct syntax to be used?

Thanks for helping me :)

Regards
Jayashree