var thelist = [1, 2, 3, 3, 4, 4, 5]; //remove duplicate items from array
<button id='go'>Go</button>
<script>
var thelist = [1, 2, 3, 3, 4, 4, 5];
var array = [3, 4];
$('#go').click(function () {
function unique(list) {
var result = [];
$.each(list, function (i, e) {
if ($.inArray(e, array ) == -1) result.push(e);
});
return result;
}
console.log(unique(thelist));
});
</script>
<button id='go'>Go</button>
<script>
var thelist = [1, 2, 3, 3, 4, 4, 5];
var array = [3, 4];
$('#go').click(function () {
function unique(list) {
var result = [];
$.each(list, function (i, e) {
if ($.inArray(e, array ) == -1) result.push(e);
});
return result;
}
console.log(unique(thelist));
});
</script>
No comments:
Post a Comment