Splice to add, replace and remove javascript array

Here is working code link :

Splice is an effective way to add, replace or remove elements from specific index in Javascript Array.

Javascript array splice() method changes the content of an array, adding new elements while removing old elements.


Its syntax is as follows −

array.splice(index, howMany, [element1][, ..., elementN]);

Parameter Details

  • index − Index at which to start changing the array.
  • howMany − An integer indicating the number of old array elements to remove. IfhowMany is 0, no elements are removed.
  • element1, …, elementN − The elements to add to the array. If you don’t specify any elements, splice simply removes the elements from the array.

Return Value

Returns the extracted array based on the passed parameters.

If you specify a different number of elements to insert than the number you’re removing, the array will have a different length at the end of the call.


Using splice()

The following script illustrates the use of splice():

var myFish = ['angel', 'clown', 'mandarin', 'surgeon'];

// removes 0 elements from index 2, and inserts 'drum'
var removed = myFish.splice(2, 0, 'drum');
// myFish is ['angel', 'clown', 'drum', 'mandarin', 'surgeon']
// removed is [], no elements removed

// removes 1 element from index 3
removed = myFish.splice(3, 1);
// myFish is ['angel', 'clown', 'drum', 'surgeon']
// removed is ['mandarin']

// removes 1 element from index 2, and inserts 'trumpet'
removed = myFish.splice(2, 1, 'trumpet');
// myFish is ['angel', 'clown', 'trumpet', 'surgeon']
// removed is ['drum']

// removes 2 elements from index 0, and inserts 'parrot', 'anemone' and 'blue'
removed = myFish.splice(0, 2, 'parrot', 'anemone', 'blue');
// myFish is ['parrot', 'anemone', 'blue', 'trumpet', 'surgeon']
// removed is ['angel', 'clown']

// removes 2 elements from index 3
removed = myFish.splice(3, Number.MAX_VALUE);
// myFish is ['parrot', 'anemone', 'blue']
// removed is ['trumpet', 'surgeon']
Leave a comment

Posted by on June 26, 2015 in AngularJs, JavaScript



AngularJs : Simple CRUD application

Here is the link of working code :

In this simple angularJs application you can perform entire crud operation of the contact management application.


Leave a comment

Posted by on June 26, 2015 in Uncategorized


AngularJs : Inheritance in Controllers

Here is link of working example :

In order to take advantage of inheritance of scope in Nested controllers, one has to define Controllers one into another using ng-controller attribute. Sometimes you don’t want to define controllers like this but still want to use power of inheritance within controllers. May be you want to put common logic into BaseController and use it in all the child controllers.

In order to achieve this, we must use $injector object that AngularJS provides.

function BMWController($scope, $injector) {

$injector.invoke(CarController, this, {$scope: $scope});

$ = 'BMW';


Leave a comment

Posted by on June 26, 2015 in AngularJs


Tags: ,

Certification : Debugging web app using chrome dev tools from google code school

Just finished the online course by google which helps in debugging web app using chrome dev tools from google code school. It has course related to memory leaks, profiling, timelines, load time calculations etc.

It is fun try it out at



Leave a comment

Posted by on June 5, 2015 in Certifications


Certification : AngularJs from google code school


Leave a comment

Posted by on June 2, 2015 in Certifications


Tags: , , ,

Certificate: AngularJs


Leave a comment

Posted by on June 2, 2015 in Certifications


Tags: ,

Free GPS navigation app for mobile (offline google maps)

Hi Friends,

Google maps are really cool, however at times when travelling through mountains its is difficult to get data connection and we might end up direction less. For the same reason, it is good to have a mobile app with offline google maps for back up navigation.

With this app, you might not required the stand alone GPS for basic navigation.

This app would make you feel at home with google maps as it is based on OpenStreetMaps api by google. you can add view points, things around you or around destination, you can add multiple way points which is not possible with current google maps mobile version. It also has a 3D rendering mechanism. 


Andriod :

MapFactor Navigator is a free turn-by-turn GPS navigation app for Android phones and tablets using OpenStreetMaps data. Maps are installed on the SD card so there is no need for an Internet connection when traveling. Map and app updates are FREE every month.

If you wish to get help or provide feedback please email, we cannot support you on Google Play.

MapFactor also makes the popular NavigatorFREE for PC, Pocket PC and WinCE.

OpenStreetMap is a collaborative project to create a free editable map of the world. For more information see

Voice guidance
* intuitive voice navigation in different languages
* door to door route planning
* cross-border routing without the need to switch between countries or to a less detailed map
* overview of the upcoming manoeuvre and distance shown on the screen

GPS satellite navigation
* 2D/3D mode allows realistic visual map display
* day/night modes switch colour schemes for day or night time driving
* map rotates in driving direction, or north up

* find nearest points of interest
* postcodes
* full GB postcodes (1.8 million)

Speed cameras
* hear audible warnings as you approach speed cameras

Leave a comment

Posted by on June 1, 2015 in Mobile Apps


Tags: , , , ,


Get every new post delivered to your Inbox.

Join 1,186 other followers

%d bloggers like this: