You should be able to enter the <script> tag directly in the HTML with the required data:
<script type="text/javascript">
var mynum = <?php echo intval($num); ?>;
var mystring = "<?php echo addslashes($string); ?>";
var myarray = <?php echo json_encode(array("one" => 1, "two" => 2)); ?>;
</script>
javascript .
:, , , , . , , , , setTimeout(), document.onready.