jQuery - How to pass multiple variables from funtion to jquery attr by Norlihazmey Ghazali

jQuery - How to pass multiple variables from funtion to jquery attr by Norlihazmey Ghazali http://stackoverflow.com/questions/33470008/how-to-pass-multiple-variables-from-funtion-to-jquery-attr/33470070#33470070

by Norlihazmey Ghazali

HTML

<input type="text"/>

JavaScript

function definingVars() {
  var Value = "Sucess with the value";
  var Id = 'aa';
  var Class = 'bb';
  return[Value, Id, Class];
}

$("input").attr({
//  var df = definingVars();  Incorrect syntax!!!
  value: definingVars()[0],
  id: definingVars()[1],
  class: definingVars()[2]
})