How to write Custom Javascript in "drupal commerce" checkout page?
As St0ik mentioned, you'll want to use drupal_add_js to add the JavaScript to the page. The real question is, where do you want it to go?

If you want it to show up on every checkout page, use the generic checkout form alter:

// Show on every page of checkout.
function MYMODULE_form_commerce_checkout_form_alter(&amp;$form, &amp;$form_state) {
  drupal_add_js(drupal_get_path('module', 'mymodule') . '/checkout-script.js');
}


If you want it to only show up on certain pages within the checkout, you can use a more specific form alter to only add it to a certain page.

// Review before payment only.
function MYMODULE_form_commerce_checkout_form_review_alter(&amp;$form, &amp;$form_state) {
  drupal_add_js(drupal_get_path('module', 'mymodule') . '/checkout-script.js');
}


or

// First page of checkout.
function MYMODULE_form_commerce_checkout_form_checkout_alter(&amp;$form, &amp;$form_state) {
  drupal_add_js(drupal_get_path('module', 'mymodule') . '/checkout-script.js');
}


You'll use MYMODULE_form_commerce_checkout_form_PAGE_alter where PAGE is the wanted checkout step.