+ 1
Can you pass an object to a function? (im assuming yes but i have doubts)
3 Respuestas
+ 3
Yes, you can.
+ 2
Absolutely...
Functions can receive arguments as parameters. Those arguments can be in the form of an object.
Example:
//Function with object as parameter.
var show_name = function(character) {
console.log(character.name);
}
//Create some sample object.
var some_character = {
name: "Mickey Mouse"
}
//Pass sample object as argument to the JavaScript Function
show_name(some_character);
+ 1
Thanx for the clarifications 😊👍