var colors = ['red', 'blue', 'green'];
var ps = document.querySelectorAll('p');
for(var i = 0; i < ps.length; i++){
    ps[i].addEventListener('click', function(){
        var j = 0;
        return function(){
            this.style.color = colors[j];
            j++;
            if(j == 3)
                j = 0;
        }
    })
}
I want to add click event on all my paragraphs so that they react independently on the click by chnging it's color
 
    