The -
symbol is reserved in Javascript, you cannot use it to refer to an object's property because Javascript thinks you're trying to do subtraction: state[0].industry - type;
Hence the error "Uncaught ReferenceError: type is not defined" - it is looking for a variable named type
to subtract with, which it can't find.
Instead, refer to it by:
state[0]['industry-type']
Because in Javascript, object.property
and object['property']
are equal.
For what it's worth, if you have control over those names, it is best practice in Javascript to name things with Camel Case, so your variable would be defined as:
var state = [{"industryType":"football","yourRole":"coach"}]
Then, you could access it like:
state[0].industryType