right-hand side of 'instanceof' is not an object

Asked Apr 30, 2020·1 reply·Last activity 6 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

I'm making a command where it will display a random block had been placed, but instead of that, it shows "right-hand side of 'instanceof' is not an object". Is there something wrong with my command? Thanks in advance!

$(touser) has mined one $(eval a=$(urlfetch json https://pastebin.com/raw/z2Z3J9Tt);a[Math.floor(Math.random()*a.length)]). $(count) total blocks have been mined.

1 reply

Hey @Golden Orangutan!

When you see this error it's often due to bad syntax, in our case here, the missing quotes. And you weren't creating an array with your block types from the pastebin, so you would have had the entire list (actually not since it goes above the characters limit, so you would have gotten an error), instead of just one block.
I've fixed it for you:

$(user) has mined one $(eval a=`$(urlfetch json https://pastebin.com/raw/z2Z3J9Tt)`.split(`|`);a[Math.floor(Math.random()*a.length)]). $(count) total blocks have been mined.

Also, you'll have to fix your pastebin file, replace every , (comma) at the end of each block by | (vertical bar), you can also remove the " (quotation marks) as well as the last , (comma)/| (vertical bar).
Here, I made a paste that will delete itself in a week, copy/paste its content in your paste: https://pastebin.com/1in9iE5f