what am i missing?
i declare a variable in php:
<?php
$MyPHPStringVar = 'Hello World';
?>          
i have a form
 <form id="from1" action="someaction.php">
    <button>xy</button>
  </form>   
i have a javascript function in which i want to retrieve the declared php variable, but if i print it (var javaScriptVar), it returns the full
 "<?php echo $MyPHPStringVar; ?>"
what am i missing?
 <script>
 var javaScriptVar = "<?php echo $MyPHPStringVar; ?>";
    document.querySelector('#from1').addEventListener('submit', function(e) {
      var form = this;
      
      e.preventDefault();
      
      swal({
          title: "Are you sure?",
          text: javaScriptVar,
          icon: "warning",
          buttons: [
            'No, cancel it!',
        'Yes, I am sure!'
    })
...
...
...
</script>
