I am trying to create a variable.
If it is not null
or empty or undefined
I do not want to add it to the @
symbol:
var T1 = 'popcorn' var T2 = 'ice cream' var T3 = ''; Var T4 = ''; If (T1! = '' || T2! = '' || T3! = '' || T4! = '') Reicastrate = T1 + '@' + T2 + '@' + T 3 + '@' + T4; Warning (reqstr);
The output is now:
popcorn @ ice cream @@
if the variable is empty I P> not clear Q; Try it: And if you want to allow numbers in your variables, then you have to do a bit more work: To allow more numbers, but etc., depending on the specification. @
[T1, T2, T3, T4]. Filler (boolean) .join ('@');
[T1, T2, T3, T4 ] .filter (function (x) {back type x === 'number' || x;}) ('@');
NaN
:
filter [T1, T2, T3, T4] . Filter (function (x) {return x === 0 || X;}). Joining ('@');
Comments
Post a Comment