Put the code into code blocks, it’s in an unusable state when it’s posted as text.
When posting to node red it’s very helpful to supply the entire flow. Highlight the nodes by selecting them. On the right, hamburger menu, choose export and copy to clipboard. Then post that output in code blocks.