So I’m on freeCodeCamp ES6 lesson:
Use Destructuring Assignment to Pass an Object as a Function’s Parameters.
And I put the example shown in the lesson in my browser console to practice with it, of course adding slightly to it, so as to try an pass arguments and see action with it:
const profileUpdate = ({ name, age, nationality, location }) => {
console.log("Hello " + name + "." + "Are you " + age + "?" + "What is your nationality?" + "Answer: " + nationality );
}
// Then when I called the function with an the following argument:
profileUpdate("Chewie", 150, "Wooki");
I then get undefined for the argument output:
Hello undefined.Are you undefined?What is your nationality?Answer: undefined
Why is that?
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge: ES6 - Use Destructuring Assignment to Pass an Object as a Function’s Parameters
Thank you for your quick response @JeremyLT
Please forgive me for any stupid questions, I’m just trying to understand the lesson and I always practice in VS code or my browser console by trying the examples in the lesson in different formats to try and understand the lesson.
That being said. So should I have put the arguments inside curley braces such as: