in the following code, why does postCodes[i].countryCode
return the last value in the loop,
and not the current value in the loop?
and how can i return the current value in the loop?
for (var i = 0; i < postCodes.length; i++) {
for (var ind = 0; ind < salesSuite.Defaults.Countries.length; ind++) {
if (postCodes[i].countryCode == myNamespace.Countries[ind].code) {
$('<button/>')
.click(function () {
console.log(postCodes[i].countryCode);
})
.appendTo($modalContent);