newdata.sort() is not a function?

function.php file code
$vars = array (
‘data’ => $data,
‘categories’ => $cat,
‘access_zero’ => $access_zero,
‘access_one’ => $access_one
);

wp_register_script( “appliance-calculation”, get_stylesheet_directory_uri() . “/assets/js/appliance-calculation.js” );
wp_enqueue_script( “appliance-calculation” );
wp_localize_script( “appliance-calculation”, “php_vars”, $vars );

var newdata = php_vars.data;
newdata.sort();
console.log( newdata );

Read more here:: newdata.sort() is not a function?

Leave a Reply

Your email address will not be published. Required fields are marked *