[Solved] How can i extract the values of a multipline string return type [duplicate]


return an array instead:

function test(){
  var price="10";
  var name="apple";
  var available="yes";
  var p = [price, name, available]; 
  return (p);
}

var test = test();
console.log(test[0]);  // price

or an object:

function test(){
  var price="10";
  var name="apple";
  var available="yes";
  var p = { price: price, name: name, available: available }; 
  return (p);
}

var test = test();
console.log(test.price); // test.xxx

0

solved How can i extract the values of a multipline string return type [duplicate]