I created a simple function which should initialize an array and return one random element from it everytime when the function is called.
function test(str)
{
var myArray =
{
"Test1 "+ str + " Test1",
"Test2 "+ str+ " Test2"
}
return myArray[Math.random()*myArray.length+0];
}
console.log(test("FOO"));
But I get Uncaught SyntaxError: Unexpected token +