<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" data-require="jquery@*" data-semver="3.1.1"></script>
<link href="style.css" rel="stylesheet" />
<script src="script.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
alert( "ready!" );
var p = ["NPD-2016-12", "XYZ", " ", "XYZ", " "];
var c = CleanedArray(p);
var cc = DedupeArray (c);
alert (c + " : Length=" + c.length);
alert (cc + " : Length=" + cc.length);
$(".btnTest").click(function() {
alert( "Handler for .click() called." );
});
});
</script>
<script type="text/javascript">
function CleanedArray(p) {
var cleanp = [];
for (var ptr=0; ptr<p.length; ptr++) {
var tmp = p[ptr];
tmp = tmp.trim();
if (tmp.length>0) {
cleanp.push(tmp);
}
}
return cleanp;
}
function DedupeArray(aR) {
try {
var listlength = aR.length;
var newaR =[];
var currentVal = aR[0];
var uniqueElement = true;
newaR.push(currentVal);
for (var ptrOuter=1; ptrOuter<listlength; ptrOuter++) {
for (var ptrInner=2; ptrInner<listlength; ptrInner++) {
if (aR[ptr]==currentVal) {
uniqueElement = false;
}
}
if (uniqueElement) {
newaR.push(aR[ptrOuter]);
uniqueElement = true;
}
currentVal = aR[ptrOuter];
}
}
catch(err) {
console.write('Error in DedupeArray:' + err.message);
}
finally {
return newaR;
}
}
</script>
</head>
<body>
<h1>Hello Plunker!</h1>
<button type="button" class="btnTest" style="background-color: blue; color: white">Test</button>
</body>
</html>
I use breakpoints all the time without issue - in fact the only real issues are
a) Finding the line of code in the first place - not always obvious
b) Remembering to remove the break point