Need help with getting object property values

const carObj = {type: "Fiat", model: "500", color: "white"};

function addYourCar(object, property, value) {
    if (value != "" && property === object.hasOwnProperty(property)) {
    } else if (value != "" && property != object.hasOwnProperty(property)) {
    } else {
        return "Fatal error!";
addYourCar(carObj, type, "Audi");

Hy everybody!
This is my code. But the function() not working. I stuck… Please help me!
I wanna:
if (value not empty string && object has property) {give value for property}
else if ( value not empty string && object not has property) {give new property and value too}

My english is poor. Sorry! Thanks

Please explain in detail what is not working.

What do you mean by “give value for property” and “give new property and value too”.

Give new property and value to what?

You have not declared the variable named type. You need to do that first. Maybe you did not mean to use a variable for the second argument passed to the function?

Thank you your answer.
I have an object{carObj} and I want to build a function addYourCar(). It´s similar to FCC, Javascript, Record collection. When somebody give property and value: type, Audi or color, black or new property wheel, 17…then search tought carObj && make new property with value || refresh property with new value.
Thank you very much!

The line above would only work if object[property] is an array.

The line above would only work if object is an array and it is not an array.

Thank you very much!

function addYourCar(object, property, value) {
    if (object.hasOwnProperty(property) && value != "") {
        object[property] = value;
    } else if (object.hasOwnProperty(property) != property && value != "") {
        let xProp = property;
        object[xProp] = value;
    } else if (value === "" || property === "") {
        return alert("You need add some property and value!");
addYourCar(carObj, "ps", "65");

/* Now working! */