Wednesday, August 24, 2022

Some changes that I make in a mdn snippet to see it work


Was this way:

Let myFunc;

if (num ===0); {

    myFunc = function (theObject) {

        theObject.make = 'Toyota';

    }

}

To this:

        let myFunc21;
        num =0;//1st line added, to initialize the num
       
        if(num ===0) {
           
            myFunc21 = function (theObject) {
                return theObject.make = 'Toyota';// Was added the return
            }
        }
       
        let mi = {make:'bn'};//creating an variable to test the function
        const t = myFunc21(mi);//creating another variable to keep the function result


And after I would put an way to print that but also you could go to the console and write directly t

and will answer 'Toyota', or ad in your code an alert, a prompt a document.write. Rute Bezerra de Menezes Gondim



 

No comments:

Post a Comment