I have a messages object like below
const messages =
{
msg1: "the length is less by %s"
msg2: "the length is greater by %s"
}
I want to set it as a variable given a value
const value = 6
const check = messages.msg2 % value
console.log(check) // the length is greater by 6
Above is how you would do it in python using %. In javascript it gives NaN. How do I do this in javascript?