Snippets Collections
const getMessages = (status) => {
  // if(status === 'received'){
  //      return 'We are working on your order'
  // }else if(status === 'prepared'){
  //       return `Food is ready for collection`
  // }else if(status === 'onroute'){
  //       return `Your food is on its way`
  // }else if(status === 'arrived'){
  //   return `Your food has been delivered and signed for`
  // }else{
  //   return `unknown status`
  // }


  const messages = {
    received: 'We are working on your order',
    prepared: `Food is ready for collection`,
    onroute: `Your food is on its way`,
    arrived: `Your food has been delivered and signed for`
  }


  return messages[status] ?? 'unknown status'
}


const user = {
  name: 'David',
  status: 'arrived'
}


console.log(getMessages(user.status))
star

Wed Dec 21 2022 03:37:57 GMT+0000 (Coordinated Universal Time)

#dynamic #advanced-flow #object
star

Thu Oct 27 2022 02:16:42 GMT+0000 (Coordinated Universal Time) https://www.sommarskog.se/dynamic_sql.html

#sql #dynamic

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension