Galaxy Wanderer Galaxy Wanderer - 8 months ago 31
Javascript Question

Set a variable value depending on value in a conditional variable

I need something like this

var String = "";
if (i == "Inbox") {var String = "Inbox"}
if (i == "Sent") {var String = "String"}

var showMailList =

I know it's simple question, but I can't find it in google. How can I achieve this?


Simply use the property with bracket notation

var showMailList = this.props.Data[ i ].map

i will your property Inbox or Sent