I have a global variable in javascript
jQuery(document).ready(function() {
   var soft1414;
   $( ".single_variation_wrap" ).on( "show_variation", function ( event, variation ) {
      soft1414 =  $("#pa_soft-cover-1414").val();    
      console.log(soft1414); 
   });
   
    console.log(soft1414);
    var quantity = $('#component_1516789119 .component_content input.qty').val(soft1414);
});
what is wrong with my code?