How to replace an item in an array

We may face this situation a lot in Javascript development. So the below is the simply solution to replace an item in an array with splice() method. // replace France to Italia var countries = ['USA', 'France', 'England']; countries.splice(1, 1, 'Italia'); console.log(countries); // ["USA", "Italia" »

Create a custom directive in AngularJS

What are directives? If you are learning about AngularJS, you need to know what is directive and why it is important. So what is directive? You can see ng-app, ng-controller and so on that are directives build in of AngularJS. In some special case we need »