Problem Passing php variable to Javascript

Basically I have some php variables with content that I need to “import” and use in Javascript variables, but when I do so I get a weird error that theres a br tag or Nan values.
In the template.php

<?php
      $mode = "lista";
      $pages = "2";   
      $shortcodeactpasadas = '[actividades_shortcode pagina="'.$pages.'" modo="'.$mode.'" fecha="pasadas"]';
      echo do_shortcode($shortcodeactpasadas); ?>
  1. in the script:

var modoShortcode = "<?php echo $mode ?>";

  1. error in console:
    image

  2. firefox debugger
    image