Using not more than a simple Google search,
var randomnumber=Math.floor(Math.random()*21)-10
Math.random()*21)
returns a number between 0 and 20. Substracting 10 would yield a random number between -10 and 10.
My advice: try to Google first, and than ask about the results, e.g.:
What is the best way to get a random number? I've googled and found methods X and Y, and wondered which is best for purpose Z.