JavaScript comments to explain code and prevent execution of code
Comments in JavaScript can be used to explain JavaScript code or to prevent execution of lines.
Single line comments
The following example shows you how to use single line comments by using the ‘//
’.
async payload => {
// Check the channel of the user
let channel = payload.channelName
}
Multi line comments
To place multi line comments you can use the ‘/*
’ to open the comment section and ‘*/
’ to close.
async payload => {
/*
Check the channel of the user
Now we can change the flows based on the channel
*/
let channel = payload.channelName
}
Prevent execution of lines
To prevent execution of lines you can use both of prior methods and is great for testing.
async payload => {
// Check the channel of the user
let channel = payload.channelName
if(channel === 'messenger'){
trigger('Channel-Messenger')
}
/*
if(channel === 'socket'){
trigger('Channel-Socket')
}
*/
}