Skip to main content
Inspiring
November 12, 2018
Answered

Any trick how to view with out spaces?

  • November 12, 2018
  • 5 replies
  • 633 views

var num=12

var num1=33

var hm=apple

var al=orange

if var's has values:

var num=12

var num1=33

var hm=apple

var al=orange

this.getField("Text1").value="check"+num+" "+hm+" "+num1+" "+al+" with :"

i want this

check 12 apple 33 orange

but when i have

var num=""

var num1=33

var hm=""

var al=orange

check     33 orange

why var with "" system add space? how to add "nothing"

e.g.

check 33 orange

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Bernd Alheit

How to create that? Any example please?


var text1 = "name:";

var text2 = "";

var text3 = text1;

if (text2 != "") text3 = text3 + " " + text2;

5 replies

Bernd Alheit
Community Expert
Community Expert
November 12, 2018

In your code you adds the spaces like this:

+" "+

hackertomAuthor
Inspiring
November 13, 2018

Yes because on this e.g

check 12 apple 33 orange

Must have +" "+

Bernd Alheit
Community Expert
Community Expert
November 13, 2018

Add the space only when you add non-empty text.