Right-hand side of 'Instanceof' is not an object

I am trying to count the amount of times this song plays over to match my stream time, but i keep getting the same message, maybe you guys can help me out.

The crazy train has run $(eval var u = “$(twitch hazardous_daze “{{uptimeLength}}”)” ;var t = 0;var y = u.match(“(\d+) y”);if (y != null) t += +y[1] * 31557600;var mo = u.match(“(\d+) mo”);if (mo != null) t += +mo[1] * 2629800;var d = u.match(“(\d+) d”);if (d != null) t += +d[1] * 86400;var h = u.match(“(\d+) h”);if (h != null) t += +h[1] * 3600;var m = u.match(“(\d+) m”);if (m != null) t += +m[1] * 60;t += +u.match(“(\d+) s”)[1];Math.floor(t/296); ) times!

Hey @hazardous_daze!

I rewrote your code so it’s shorter and it works, have a look at it and feel free to ask questions:

$(eval 
u=`$(twitch $(channel) "{{uptimeLength}}")`;
t=u.match(/\d+/g);
if(t==null){
	t=0;}
else{
	while(t.length<6){
		t.unshift(0);}
	t[0]*=31556926;
	t[1]*=2628003;
	t[2]*=86400;
	t[3]*=3600;
	t[4]*=60;
	t=t.reduce((a,b)=>a+b,0)}
`The crazy train has run ${Math.floor(t/296)} times`
)

So here’s the code to copy/paste:

$(eval u=`$(twitch $(channel) "{{uptimeLength}}")`;t=u.match(/\d+/g);if(t==null){t=0;}else{while(t.length<6){t.unshift(0);}t[0]*=31556926;t[1]*=2628003;t[2]*=86400;t[3]*=3600;t[4]*=60;t=t.reduce((a,b)=>a+b,0)}`The crazy train has run ${Math.floor(t/296)} times`)
2 Likes

That worked!! Thank you so much for your help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.