array element update2

by Nivaldo

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.12.0/lodash.min.js"></script>

JavaScript

// replacing elements in arr1 with same-id elements in array 2
// e.g. the id here is 'code'
// see http://stackoverflow.com/questions/27641731/is-there-a-function-in-lodash-to-replace-matched-item

var allEntitlementsStr  = 'PI,PA,PB';
var allEntitlementsArr = allEntitlementsStr.split(',');
console.log(allEntitlementsArr);
var newArray = [];
for (ct=0; ct<allEntitlementsArr.length; ct++) {
	newArray.push({code: allEntitlementsArr[ct], checked: true})
  console.log(ct);
};
console.log(newArray);