Q:

replace the first two character in JSON object using javascript

I need to replace the first two string from JSON object 
my JSON object is 
{userName: "TT-RRR-000", sName: "KLIU"}

I need to update my JSON object to
{userName: "LL-RRR-000", sName: "KLIU"}

how can I do that?  I tried with string replace method but it not working for me 
EDIT:
The character[s] will not be TT it may be anything.  I need to replace the first two characters of the string

A:

You can use a regular expression to replace "TT" or ANY character with "LL":
/^.{2}/
See working example below:

let my_obj = {userName: "TT-RRR-000", sName: "KLIU"};

my_obj.userName = my_obj.userName.replace(/^.{2}/, 'LL');
console.log(my_obj);

Or, as others have pointed out, you can use substr/substring to remove the first two characters in the string:
my_obj.userName = "LL" + my_obj.userName.substr(2);

Note:- g flag is not needed as we are matching only first two character

