views:

79

answers:

1

Not sure of the best way to ask this question other than:

I'm writing a function that will accept a variable called 'x'.

function doIt(x){
  var y = someformula; //this is just a placeholder for the correct formula
  return y;
}

And here's what I expect returned:

if (x is between 0 and 9){ y = 0; }

if (x is between 10 and 19){ y = 32; }

if (x is between 20 and 29){ y = 64; }

if (x is between 30 and 39){ y = 96; }

and so on....

Any help is appreciated.

I'm doing it in JavaScript if it matters.

+10  A: 
return Math.floor(x/10) * 32;
KennyTM