Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. export const calculateRisk = (ticket) => dispatch => {
  2. const numberOfComments = ticket.comments.length
  3. let riskByComments//if i use const i need to declare its value
  4. //right away, i cannot use an if statement to do it later
  5. if(ticket.comments.length>2){
  6. riskByComments=5//if i use const inside the if statement
  7. }else{
  8. riskByComments=0//i cannot use it in the rest of my function
  9. }
  10.  
  11. const riskByComments = ticket.comments.length>2 ? 5 : 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement