Node-red beginner needs help

I have a random function to create a random number between 1 to 10, and need a debug node to tell "the random number created is x".

Suppose I should create a function node and how to code for this function node? sorry for a very simple question but I am very new to node-red and javascript.

Hi,

there is already a node to create random numbers - https://flows.nodered.org/node/node-red-node-random
(often already installed - eg on a Pi) . So no need to create another one. - just wire it to a debug node and use an inject node to trigger it.

The user-guide is probably the best place to start if you need help wit hwriting functions and how they fit in Node-RED. https://nodered.org/docs/user-guide/

Where do you want to display this? The standard Debug node shows its value in the right hand pane of the editor.

Yes, I want to show it in the right hand pane of the editor

If you use a Debug node and give it a name then the name appears with the value in the debug pane. Remember the editor and debug page are for development and are not intended to be used as an alternative to the dashboard.

As you've revealed in your other post that you are doing the Coursera Intro to IoT course, your questions here suggest you've not watched and read the material from the course. It covers these basics of Node-RED.