Code-based Actions: Javascript Comments

Comments in JavaScript can be used to explain JavaScript code or to prevent the execution of lines of code.

Single line comments

The following example shows you how to use single-line comments by using the '//' in your code.

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 it.

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 the execution of lines of code, you can use both of the above methods.

async payload => {

  // Check the channel of the user  
  let channel = payload.channelName

  if(channel === 'messenger'){  
    trigger('Channel-Messenger')  
  }  
  /_  
  if(channel === 'socket'){  
    trigger('Channel-Socket')  
  }  
  _/  
}