I can’t return multiple values in javascript return statement. Would it be useful to wrap these values in a js object? or other solution?
function buildSomething()
var t = [];
var x = [];
var y = [];
var h = [];
var myValues = fnGetData(t,y,x,h);
function fnGetData(t,y,x,h)
{
// do something
// return t,y,x,h
}
Looking closely at your code, it looks like you’re trying to pass multiple values into a function. Using an object for this is a common idiom in JavaScript.
It also makes it easy to handle default data
I’m not sure if you’re using jQuery or not, but there’s a common jQuery idiom for this as well: