I thought I'd share this from Helen Lynn. I guess we'd be just out of shot on the right of the image...
Dominic Myers writes about all sorts of stuff to do with HTML, CSS, JavaScript and a fair chunk of self-indulgent stuff. Thoughts and opinions are all his own, and nothing to do with any employer.
Monday 23 April 2012
Friday 20 April 2012
Thursday 19 April 2012
Finding the numbers that a number is divisible by...
I'm no Math geek (Hi Dr G!) but I needed to figure out all the numbers that a particular number was divisible by so that I could scale it without having to rely on The Gimps algorithms to smooth it so I wrote the following script:
(function(){ var num = 15; for(var n = 1; n < (num / 2); n++){ var res = num / n; if (res === Math.round(res)){ document.write("<p>" + res + "</p>"); } } })();Works a treat, just add your number as
num
variable and run in the browser
Subscribe to:
Posts (Atom)