Hi Akshay
You can drag a function node into NodeRED and write code in it. You can write the function code in your favorite editor then cut and paste into the function node. The video also shows a method of importing. Do whatever works best for how you like to work.
Here is a link for writing functions in NodeRED
https://nodered.org/docs/writing-functions
Kind regards,
Leon