Blog

Archive for the JavaScript Category


In JavaScript Write a Function to Split a String without using split();
Posted on June 5, 2015 in Algorithms, JavaScript by Matt Jennings

/* Function to Split a String into an Array using a single space as a
delimiter without using the split(); function
*/

function …

Read more


In JavaScript Create an Array with Odd Numbers
Posted on June 4, 2015 in Algorithms, JavaScript by Matt Jennings

Create an array with odd numbers from 1 to 255 and print out this array:

var y = [];

for(var i = …

Read more


In JavaScript Find the Average of the Sum of All Elements in an Array
Posted on June 3, 2015 in Algorithms, JavaScript by Matt Jennings

var x = [3, 9, 6];
var sum = 0;

for(var i = 0; i < x.length; i++) {

Read more


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