jQuery | Change text with parametrs

I have a link - https://mydomain/?utm_replace=nastya

And code

let params = (new URL(document.location)).searchParams; //get params "utm_replace=nastya"
var name_girl = params.get("utm_replace"); //we had just text "nastya"
let names = {anna: 'Анна', nastya: 'Настя'};


How can I substitute a value from an object into a variable?

If i do this

$('#smena a .name').text(name_girl); // i had "nastya"

But i need "Настя". How can i do it?


Ответы (0 шт):