In some programming languages (including c++ and js), the comma operator stands for "Evaluate all the expressions separated by commas and return the last one". For example:
var x = (true, false, 1);
console.log(x) // 1
Here's another one to show you that expressions are evaluated:
var i = 0;
var j = 0;
var x = (i++, j--);
console.log(i, j, x) // 1 -1 0
The function AddWaterMark
essentially can be rewritten as:
function AddWatermark(controlName, defaultValue, cssValue) {
if (document.getElementById(controlName).value == "") {
document.getElementById(controlName).value = defaultValue;
document.getElementById(controlName).className = cssValue;
}
}