JavaScript is a client side scripting language. To run Javascript browser has to enable javascript execution . 90% of browsers are enabled by default. More advance implementation of javascript is AJAX.
Most of the times client side validations done by javascript. Javascript can embedded to html with in tag , Or we can use javascript as separate file .This file name extension would be .js .
Most SEO experts recommend to have separate .js file for javascript. Because web crawlers can’t execute javascript code.