How to separate value based on key in javascript? -
this code meant print action key value:
result [ { action: 'test' }, { action: 'tests' }, { action: 'tested' } ]; (value = 0; value <= result.length; value ++) { response = this.actions[value]['action']; alert("actions are: " + response); }
however, causes error: action cannot read property
.
the actions in code not defined, try:
result = [ {action: 'test'}, {action: 'tests'}, {action: 'tested'} ]; for(value = 0; value <=result.length; value ++) { response = this.result[value]['action']; alert("actions are: " +response); }
Comments
Post a Comment