Skip to content

Instantly share code, notes, and snippets.

@phstc
Created December 2, 2013 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phstc/7750295 to your computer and use it in GitHub Desktop.
Save phstc/7750295 to your computer and use it in GitHub Desktop.
var payload = { parameters: [{ name: 'test', 'value': 'abc' }, { name: 'test2', value: 'def' }] };
function updateParameter(name, value){
payload['parameters'].forEach(function(parameter){
if(parameter['name'] === name){
parameter['value'] = value;
return false; // break
}
});
}
updateParameter('test', 'xpto');
updateParameter('test2', 'xxxx');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment