Recent Posts
- 10 Things To Do When Launching A Site
- Using PHP to connect to SFTP
- Asynchronous Virtual Pageviews with Google Analytics
- 5 Advanced Text Editing Keyboard Shortcuts
- Get the headers of a HTTP request with PHP
- How-to: Create PDF preview images in PHP – Part 2
- How-to: Create PDF preview images in PHP
- Quick Code: Get the domain name in JS
- Things to think about when designing a logo
- Javascript Array Functions
Topics
ImageXY
ImageXY - Mac OS X Batch Photo Resizer

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.