title: Javascript - how to echo php in javascript
body: <p>How do I echo php inside javascript correctly?</p>
  
  <pre><code>var timeDiff = 60-20;
  if ( timeDiff &lt;= 60 ) {
     var stamp = timeDiff &lt;?php echo $this-&gt;__('second ago') . '.'; ?&gt;;
  }
  </code></pre>
  
  <p>Console error: </p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected identifier </p>
  </blockquote>
  
  <p>It does echo out 'second ago' in chromes Sources, followed by the error though.</p>