title: How to customize a string by variable in Javascript?
body: <p>I want to print an errormessage using javascript in certain cases. The string is german and the start depends on a variable called <code>blfType</code> which can be &quot;field&quot;, &quot;line&quot; or &quot;block&quot; and the string then would be &quot;This field already has this prerequisite&quot; if <code>blfType</code> is field.
  I tried to do that similiar as I would do it in python:</p>
  <pre><code>alert(&quot;Das Feld&quot;*(blfType == 'field') + &quot;Die Zeile&quot;*(blfType == 'line') + &quot;Der Block&quot;*(blfType == 'block')+&quot; besitzt diese Vorraussetzung bereits&quot;);
  </code></pre>
  <p>But this would just print <code>&quot;NaN besitzt diese Vorraussetzung bereits&quot;</code>.
  Is there any other way how I can do this in just one line or do I have to do create another Variable that takes the start of the sentence.</p>
  <hr />
  <p>In this case I would do this in python like that:</p>
  <pre><code>const gerblfType = &quot;Feld&quot; if blfType === &quot;field&quot; else &quot;Zeile&quot; if blfType === &quot;line&quot; else &quot;Block&quot;
  </code></pre>
  <p>But this is also not working. Is there a smooth way in Javascript to not do it like that:</p>
  <pre><code>gerblfType = &quot;Feld&quot;;
  if(blfType == &quot;line&quot;) gerblfType = &quot;Zeile&quot;;
  if(blfType == &quot;block&quot;) gerblfType = &quot;Block&quot;;
  </code></pre>