Uncaught TypeError: Object 1 has no method 'indexOf'
<p>I guess this is largely a problem with my syntax in javascript. I currently have this line in a javascript function that posts a message to channel 1 with realtime.co    </p>

<pre><code>xRTML.ConnectionManager.sendMessage({connections: ['myConnection'], channel: '1',
                                    content:xrtmlMessage});
</code></pre>

<p>This works fine.<br>
My problem is using a variable, let's say 'x', instead of explicitly stating  - channel: '1'.<br>
Essentially I want to be able to post to different channels by writing - ... channel: x, ...<br>
But writing this gives the error:<br>
Uncaught TypeError: Object 1 has no method 'indexOf'<br>
'x' is already declared as x=1;<br>
So I tried declaring y='1'; (with single marks instead of none) and writing channel: y - and this works. So I tried building this as a string (mark 1 mark) </p>

<pre><code>y = "'" + x + "'";
</code></pre>

<p>This gives the error that the channel has invalid characters, so no double quotation marks or escaping the single mark with a backslash either, tried that. I also tried parseInt(x); to ensure x was an integer, to no avail.<br>
Has anyone got any other suggestions or even tried doing the same thing with xRTML?<br>
Thanks in advance</p>
