Code - Variable If Else

Hello!

I’m trying to do a very simple code.

If the number has 10 digits, insert a 9. If not, do nothing.

It happens that I can’t use the variables that I set and I can’t use the If/Else function.

Can someone can help me, please?

Example:

Hi @Fabio_Santos1

If I understood correctly, this is the answer to your question.

for (const item of $input.all()) {
if (item.json.phone.substring==“10”) {
item.json.message=“9”;
}
else if (item.json.phone.substring!=“10”) {
item.json.message=“1”;
}
}

return $input.all();