Jave script not loading

I have the script added to the Java Script Editor within a Forms for SharePoint online.
The script should hide 2 fields depending on the value of another YES/NO field.
When opening the form within the online SharePoint, fields are not hidden.

what is wrong here?

fd.spRendered(function() {

function ShowHideHardwareFields() {
    if (fd.field('New_x0020_Hardware').value = $True) {
        // Show the Free Patch field
        $(fd.field('Free_x0020_Patch').$parent.$el).show();
    } else {
        // Hide the Free Patch field
        $(fd.field('Free_x0020_Patch').$parent.$el).hide();
    }
	if (fd.field('New Hardware').value = $True) {
        // Show the patch number field
        $(fd.field('Patch_x0020_Number').$parent.$el).show();
    } else {
        // Hide the patch number field
        $(fd.field('Patch_x0020_Number').$parent.$el).hide();
    }

}


// Calling hideOrShowDueDate when the user changes the Start Date
fd.field('New_x0020_Hardware').$True('change',ShowHideHardwareFields);
fd.field('Patch_x0020_Number').$True('change',ShowHideHardwareFields);
// Calling hideOrShowDueDate on form loading
ShowHideHardwareFields();

});

= is used for assigning a value.
== is used for checking if something equals that value.

Dear @FransKluijtmans,
As Maura has said, there are some issues with JS, especially in conditions. Not only =, but also $True are incorrect, they should be == and true instead.

Please, try it like this:

if (fd.field('New_x0020_Hardware').value == true) {
    // Show the Free Patch field
    $(fd.field('Free_x0020_Patch').$parent.$el).show();
} else {
    // Hide the Free Patch field
    $(fd.field('Free_x0020_Patch').$parent.$el).hide();
}