JavaScript is a most popular prototype-based object-oriented scripting language designed for performing dynamic tasks. JavaScript support is built right into web browsers.Provided that the visitors to your site are using web browsers that support JavaScript (most do) and have Javascript enabled (it is by default) then your Javascript will run. JavaScript use for create dynamic and interactive web content.
How to Add JavaScript in PHP file
<?php
//Some php statements
?>
<html>
<head
<title></title>
<script type="text/javascript">
// your JavaScript code goes here
// your JavaScript code goes here
</script>
</head>
<body>
<? //Some php statements?>
</body>
</html>
