I was working on a simple programming exercise that my teacher gave me, and I noticed several times that in Javascript I need to divide the number by 1, otherwise it will return a ridiculous value. Any explanation? I have jsfiddle http://jsfiddle.net/TpNay/1/
var widthrand=Math.floor(Math.random()*widthRange); width=widthrand + document.getElementById('width').value/1;
If you look at line 22 and pull out the division by 1 and press βgenerateβ, it will return funny lengths Thanks
source share