JSON is a formatting of the data but when you are coding you are using javascript. You can see the format of a javascript if statement at w3school.com:
JavaScript if else else if
Not knowing what your data looks like, I can't tell you what the if statement should look like.
You need to show what the msg going into the function
node is so add a debug
node (set to display the complete msg object) to the node sending the msg to the function
node.
Copy and paste the output to a reply
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
You can edit and correct your post by clicking the pencil icon.
See this post for more details - How to share code or flow json
You should also take a JavaScript Tutorial