“The editor has encountered an unexpected error” After add defer tag to java script

I added below script to add defer tag in javascripts. Once it added to function.php
Gets error on create post “The editor has encountered an unexpected error.” I cannot create or edit post.
How can i add defer tag to javascripts without affecting to the editor. I don’t have mush experience in coding. Thanks.

Error – ‘create_function is deprecated’

Our WP Debug is report that ‘Function create_function() is deprecated’. Any idea how to rewrite this code to not include create_function ? self::register_form_init_scripts( $form, $field_values, $ajax ); if ( apply_filters( 'gform_init_scripts_footer', false ) ) { add_action( 'wp_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ), 20 ); add_action( 'gform_preview_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . … Read more