Use commented if block to prevent add values which has already in array if you use button click or something to run the insertion
$('#myDiv').change(function() {_x000D_
var values = [];_x000D_
{_x000D_
$('#myDiv :checked').each(function() {_x000D_
//if(values.indexOf($(this).val()) === -1){_x000D_
values.push($(this).val());_x000D_
// }_x000D_
});_x000D_
console.log(values);_x000D_
}_x000D_
});
_x000D_
<div id="myDiv">_x000D_
<input type="checkbox" name="type" value="4" />_x000D_
<input type="checkbox" name="type" value="3" />_x000D_
<input type="checkbox" name="type" value="1" />_x000D_
<input type="checkbox" name="type" value="5" />_x000D_
</div>_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
_x000D_