Accessibility Navigation

ImageXY

ImageXY - Mac OS X Batch Photo Resizer

Checkout ImageXY - Painless image resizing for Mac OS X.

Quickly and painlessly bulk resize images, change image formats and create web-friendly photos for your website.

Available on the Mac App Store!

Javascript Array Functions

Without using a Javascript library such as JQuery, there are very few functions built into Javascript to deal with arrays. Here are a few of my own that often come in handy when working on projects.

In Array

This function checks to see if a value is in an array. JQuery has a built in function of the same name that does the same thing.

function inArray(value, array){
	for(var x=0;x<array.length;x++){
		if(array[x]==value){
			return 1;
		}
	}
	
	return 0;
}

Remove From Array

This function removes a value from an array.

function removeFromArray(value, array){
	for(var x=0;x<array.length;x++){
		if(array[x]==value){
			array.splice(x, 1);
		}
	}

	return array;
}

Simple bits of code, but of a lot of use when creating dynamic client side interfaces with Javascript. Let me know in the comments if you have any other little functions that you often use.


About The Author

Jacob Wyke is a web developer from the UK who makes complex things simple on the internet. He develops a batch image resizer for Mac OS X called ImageXY which you should try if you ever need to resize anything for the web.

You should also follow him on twitter.