I have a flexible amount of titles, aka title1, title2, title3 etc. How can i create a dynamic variable that gives me the value of that field?
function getTitle(i){
var myScope={}
myScope["title"+i]="title"+i // should i use this in any way, and how?
var output = props.attributes.title1 // This works, but it is static. Instead the 1, add the value of i here like:
var output = props.attributes.title+i
return output
}
I would like to concatenate the value of i to the word 'title'. So it becomes title1 or title2 etc.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/K6OlQDJ
Comments
Post a Comment