Удаление дубликатов из массива


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function removeDuplicateElement(arrayName)
  2. {
  3. var newArray=new Array();
  4. label:for(var i=0; i<arrayName.length;i++ )
  5. {
  6. for(var j=0; j<newArray.length;j++ )
  7. {
  8. if(newArray[j]==arrayName[i])
  9. continue label;
  10. }
  11. newArray[newArray.length] = arrayName[i];
  12. }
  13. return newArray;
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.