How can I efficiently combine name elements without any extra white space in Vue.js?
let FirstName = "John"
let MI = "G"
let LastName = "Jones"
let Suffix = "Jr."
I want to create let fullName = "John G Jones Jr."
However, in cases like this:
let FirstName = "John"
let MI = "" or null
let LastName = "Jones"
let Suffix = "" or null
I aim for let fullName = "John Jones" without any additional white spaces.
Simply concatenating with spaces will not suffice. Is there a more elegant solution than using multiple if statements?
Considering the constraints of working within a Vue.js environment and not being able to rely on jQuery.
Thank you