How to Remove unused JavaScript in WordPress website

Sometime JavaScript code decrease your website’s performance and user experience. If you want to remove unused JavaScript so paste simple code on your website.

Code –

function wp_remove_scripts() {
// check if user is admin
if (current_user_can( 'update_core' )) {
return;
}
else {
// Check for the page you want to target
if ( is_page( 'home' ) ) {
// Remove Scripts
wp_dequeue_style( 'jquery-ui-core' );
}
}
}
add_action( 'wp_enqueue_scripts', 'wp_remove_scripts', 99 );

How to Do

>> Open functions.php file of active theme’s file.
>> Then Paste given code and SAVE file.

In this way you can increase website performance, Have any other type help so comment me.