Blog

Archive for the Algorithms Category


In JavaScript Find the Max Value in an Array
Posted on June 3, 2015 in Algorithms, JavaScript by Matt Jennings

var x = [1,5,7,10];
var max = x[0];

for(var i = 0; i < x.length; i++) {
if(x[i] > …

Read more


In JavaScript Print the Sum of 0 to 255
Posted on June 2, 2015 in Algorithms, JavaScript by Matt Jennings

Print the sum of 0 + 1 + 2 + 3 + …. + 255:

var sum = 0;
for(var 0 = …

Read more


In JavaScript Print all the numbers from 1 to 255
Posted on June 2, 2015 in Algorithms, JavaScript by Matt Jennings

for(var i = 1; i < 256; i++) {
console.log(i);
}