<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Uncaught SyntaxError: Unexpected token return]]></title><description><![CDATA[<p dir="auto">I’m creating a new module. I’m testing and get the error “Uncaught SyntaxError: Unexpected token return”  at the line where is</p>
<pre><code>return table;
</code></pre>
<p dir="auto">This is the part where it goes wrong.<br />
I’ve been looking for typos and other errors, but cannot find them.<br />
Has anybody a clue?</p>
<pre><code>
	getDom: function() {
		
		// creating the table
		var table = document.createElement("table");
		table.className = "small";
		
		// creating the wrapper
		var wrapper = document.createElement("div");
		wrapper.className = "wrapper";
		wrapper.style.maxWidth = this.config.maxWidth;
	
		// The loading sequence
        	if (!this.loaded) {
            	    wrapper.innerHTML = "Loading....";
            	    wrapper.classList.add("bright", "light", "small");
            	    return wrapper;
        	}	
		
		var MWB = this.MWB;

		// creating the tablerows
		var WoonplaatsRow = document.createElement("tr")
		WoonplaatsRow.className = "woonplaats-row";
		
		var WoonplaatsCell = document.createElement("td");
		WoonplaatsCell.className = "small";
		WoonplaatsCell.innerHTML = "Regel1";
		WoonplaatsRow.appendChild(WoonplaatsCell);
		table.appendChild(WoonplaatsRow);
		
		var TemperatuurRow = document.createElement("tr")
		TemperatuurRow.className = "temperatuur-row";
		
		var TemperatuurCell = document.createElement("td");
		TemperatuurCell.className = "small";
		TemperatuurCell.innerHTML = "Regel2"
		TemperatuurRow.appendChild(TemperatuurCell);
		table.appendChild(TemperatuurRow);
					
		}		
		return table;		
	
	}, // &lt;-- closes the getDom function from above```</code></pre>
]]></description><link>https://forum.magicmirror.builders/topic/10109/uncaught-syntaxerror-unexpected-token-return</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 17:20:10 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/10109.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Mar 2019 15:46:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Sat, 23 Mar 2019 16:13:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> Oké, thank you for the explanation.</p>
]]></description><link>https://forum.magicmirror.builders/post/54782</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54782</guid><dc:creator><![CDATA[htilburgs]]></dc:creator><pubDate>Sat, 23 Mar 2019 16:13:50 GMT</pubDate></item><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Sat, 23 Mar 2019 14:21:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/htilburgs" aria-label="Profile: htilburgs">@<bdi>htilburgs</bdi></a> not so much numbers,  but variable data… the notation</p>
<pre><code>MWB.n.plaats
</code></pre>
<p dir="auto">means the plaats element of the n element of MWB<br />
so the dot notation treats the between dot things as literals…</p>
<p dir="auto">a number can’t be a  variable name literal in this sense…<br />
so, you need the bracket notation [] (and remove the left side dot when u use it this way)</p>
]]></description><link>https://forum.magicmirror.builders/post/54778</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54778</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 23 Mar 2019 14:21:11 GMT</pubDate></item><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Sat, 23 Mar 2019 14:02:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> YES, that did the trick! Learning a lot these few days.<br />
Thanks again.</p>
<p dir="auto">Is this notation always like this if you’re working with numbers?</p>
]]></description><link>https://forum.magicmirror.builders/post/54777</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54777</guid><dc:creator><![CDATA[htilburgs]]></dc:creator><pubDate>Sat, 23 Mar 2019 14:02:57 GMT</pubDate></item><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Sat, 23 Mar 2019 13:26:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/htilburgs" aria-label="Profile: htilburgs">@<bdi>htilburgs</bdi></a> said in <a href="/post/54772">Uncaught SyntaxError: Unexpected token return</a>:</p>
<blockquote>
<p dir="auto">WoonplaatsCell.innerHTML = MWB.[‘0’].plaats;</p>
</blockquote>
<p dir="auto">sorry, my bad, try these</p>
<pre><code>WoonplaatsCell.innerHTML = MWB[n].plaats;
WoonplaatsCell.innerHTML = MWB['0'].plaats;
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/54774</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54774</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 23 Mar 2019 13:26:36 GMT</pubDate></item><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Sat, 23 Mar 2019 13:00:09 GMT]]></title><description><![CDATA[<p dir="auto">No luck…<br />
I’ve tried both of the options:</p>
<pre><code>	var MWB = this.MWB;
	var n = 0;

	// creating the tablerows
	var WoonplaatsRow = document.createElement("tr");
	WoonplaatsRow.className = "woonplaats-row";
	
	var WoonplaatsCell = document.createElement("td");
	WoonplaatsCell.className = "small";
	WoonplaatsCell.innerHTML = MWB.n.plaats;
	WoonplaatsRow.appendChild(WoonplaatsCell);
	table.appendChild(WoonplaatsRow);
</code></pre>
<p dir="auto">Error: Uncaught (in promise) TypeError: Cannot read property ‘plaats’ of undefined</p>
<pre><code>	var MWB = this.MWB;

	// creating the tablerows
	var WoonplaatsRow = document.createElement("tr");
	WoonplaatsRow.className = "woonplaats-row";
	
	var WoonplaatsCell = document.createElement("td");
	WoonplaatsCell.className = "small";
	WoonplaatsCell.innerHTML = MWB.['0'].plaats;
	WoonplaatsRow.appendChild(WoonplaatsCell);
	table.appendChild(WoonplaatsRow);
</code></pre>
<p dir="auto">Error: Uncaught SyntaxError: Unexpected token [</p>
<p dir="auto">So both of the options give an error.</p>
]]></description><link>https://forum.magicmirror.builders/post/54772</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54772</guid><dc:creator><![CDATA[htilburgs]]></dc:creator><pubDate>Sat, 23 Mar 2019 13:00:09 GMT</pubDate></item><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Sat, 23 Mar 2019 12:13:31 GMT]]></title><description><![CDATA[<p dir="auto">use a variable to hold the value</p>
<p dir="auto">var x = 0</p>
<p dir="auto">WoonplaatsCell.innerHTML = MWB.x.plaats;<br />
or use a literal</p>
<p dir="auto">WoonplaatsCell.innerHTML = MWB.[‘0’].plaats;</p>
]]></description><link>https://forum.magicmirror.builders/post/54766</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54766</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 23 Mar 2019 12:13:31 GMT</pubDate></item><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Sat, 23 Mar 2019 10:14:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> , thanx, missed that.<br />
Now that this part is running the JSON data is fetched. But when I trying to show the data I get an error:</p>
<pre><code>Uncaught SyntaxError: Unexpected number
</code></pre>
<p dir="auto">This error is created by the zero in the line:<br />
WoonplaatsCell.innerHTML = MWB.<strong>0</strong>.plaats;</p>
<pre><code>		var MWB = this.MWB;

		// creating the tablerows
		var WoonplaatsRow = document.createElement("tr");
		WoonplaatsRow.className = "woonplaats-row";
		
		var WoonplaatsCell = document.createElement("td");
		WoonplaatsCell.className = "small";
		WoonplaatsCell.innerHTML = MWB.0.plaats;
		WoonplaatsRow.appendChild(WoonplaatsCell);
		table.appendChild(WoonplaatsRow);
</code></pre>
<p dir="auto">The problem seems that I cannot use the <strong>0</strong> in the command.</p>
<p dir="auto">This is the JSON result</p>
<pre><code>object{1}
	liveweer[1]
		0{49}
			alarm: "0"
			d0neerslag: "4"
			d0tmax: "12"
			plaats: "Amsterdam"
			...
</code></pre>
<p dir="auto">I used a JSON checker and it says that it’s valid JSON.<br />
How do I display the data from this result, if I cannot use the <strong>0</strong>?</p>
]]></description><link>https://forum.magicmirror.builders/post/54762</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54762</guid><dc:creator><![CDATA[htilburgs]]></dc:creator><pubDate>Sat, 23 Mar 2019 10:14:16 GMT</pubDate></item><item><title><![CDATA[Reply to Uncaught SyntaxError: Unexpected token return on Fri, 22 Mar 2019 17:50:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/htilburgs" aria-label="Profile: htilburgs">@<bdi>htilburgs</bdi></a> said in <a href="/post/54733">Uncaught SyntaxError: Unexpected token return</a>:</p>
<blockquote>
<pre><code>  }		
  return table;		
</code></pre>
</blockquote>
<p dir="auto">u have an extra close brace, which matches up with the getDom() {<br />
and so, that return is just hanging out there</p>
]]></description><link>https://forum.magicmirror.builders/post/54741</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/54741</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Fri, 22 Mar 2019 17:50:29 GMT</pubDate></item></channel></rss>