// mystring contains dynamic text. Sometimes can be
// null
var a = mystring.split(" ");
var proc = a[0] + " " + a[1];
If a does not contain text, after split proc is undefined. If I try to assing its value to a textbox the result is "undefined":
mytextbox.val(proc);

So I need a way to make that proc has always a value, at least an empty string.
mytextbox.val(proc || '')would do it.ifdidn't work. It mathes always as undefinedif( mystring && mystring.length ) { // all the rest }mystringreallynull? I think you mean the empty string.