Handling JavaScript Dectection Error

Dear Experts,
I have used the following JavaScript detection code from twentyseventeen:

/**
* Handles JavaScript detection.
*
* Adds a `js` class to the root `<html>` element when JavaScript is detected.
*/
function x_javascript_detection() {
echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n";
}
add_action( 'wp_head', 'x_javascript_detection', 0 );

Mentor Themeforest plugin shows the following error:

Script tags should be included on wp_enqueue_scripts or admin_enqueue_scripts instead of embedded directly at file functions.php, line 149: echo ā€œ\nā€;

Is it an issue for approval?

Thanks much.