As a beginner in JS I'm trying to concatenate the value of an input to a random value that I generated, as if typing the name was generated a random user name for the person, I thought of saving the name in a function and then concatenating both , the problem is that I do not know how to do a function that saves the value typed. Someone willing to give a light?
Here are the functions I have so far, being function receber_nome()
to which I can not mount logic.
function receber_nome()
{
}
function gerar_string_aleatoria( tam, charset )
{
var serial = "";
for( var i = 0; i < tam; i++ )
serial += charset.charAt( Math.floor(Math.random() * charset.length) );
return serial;
}
function gerar_serial()
{
return receber_nome() + gerar_string_aleatoria( 4, "0123456789" );
}