how to use 'for' to shorten my code ?

how to use 'for' to shorten my code ?

Hi,

I would like to replace this part of my code : 
  1.   $('.home').on('click', function() {
  2.   $('html, body').animate({ scrollTop: $("#home").offset().top}, 1000);
  3.   })
  4.   $('.qui_suis-je').on('click', function() {
  5.   $('html, body').animate({ scrollTop: $("#qui_suis-je").offset().top}, 1000);
  6.   })
  7.   $('.competences').on('click', function() {
  8.   $('html, body').animate({ scrollTop: $("#competences").offset().top}, 1000);
  9.   })
  10.   $('.CV').on('click', function() {
  11.   $('html, body').animate({ scrollTop: $("#CV").offset().top}, 1000);
  12.   })
  13.   $('.contact').on('click', function() {
  14.   $('html, body').animate({ scrollTop: $("#contact").offset().top}, 1000);
  15.   })
by this :
  1. var elementsmenu = new Array(['.home','#home'],['.qui_suis-je','#qui_suis-je'],['.competences', '#competences'],['.CV','#CV'],['.contact','#contact']);

  2.   for(var i = 0; i < elementsmenu.length; i++) {
  3.   $(elementsmenu[i][0]).on('click', function() {
  4.   $('html, body').animate({ scrollTop: $(elementsmenu[i][1]).offset().top}, 1000);
  5.   });
  6.   }
but it doesn't work :( I don't understand what's wrong with the new code, can anybody help me ?

The code is supposed to scroll the page to a specific div when you click on a menu's element (you can see how it work directly on me website :  http://dorian.hermosa.free.fr/ )

Thank you :)