About javascript’s Parameter Usage

  node.js, question
var nickNames = {};
 handleMessageBroadcasting = function(socket, nickNames){
 socket.on('message', function(message){
 socket.broadcast.to(message.room).emit('message', {
 Text: nickNames[socket.id] plus':' plus message.text
 handleMessageBroadcasting(socket, nickNames);

The above handleMessageBroadcasting uses nickNames internally. do I pass nickNames as parameters and reuse them? Is it better to use it directly as a global variable? Why?

Parameter transmission can reduce code coupling

The most taboo thing in programming inside is global variables. The fewer global variables, the better. Even if the project size is relatively small, you may as well form this good habit.