+ 1

Can you pass an object to a function? (im assuming yes but i have doubts)

25th Dec 2017, 4:37 AM
Khalil Mohammad Khoucheich
Khalil Mohammad Khoucheich - avatar
3 Respuestas
+ 3
Yes, you can.
25th Dec 2017, 4:51 AM
Spencer
+ 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);
25th Dec 2017, 4:59 AM
David Carroll
David Carroll - avatar
+ 1
Thanx for the clarifications 😊👍
25th Dec 2017, 1:10 PM
Khalil Mohammad Khoucheich
Khalil Mohammad Khoucheich - avatar