0
Can a propertie value be a function that includes others properties?
I want display the fullName Peter Newman with and button in this JavaScript: <h2>Script17 JavaScript Objects ¿ERROR?</h2> <p id="demo17" style=color:red>Display the result here</p> <script> var person17 = { firstName: "Peter", lastName : "Newman", id : 1758, fullName : function myFunction17() { return firstName + " " + lastName } }; </script> <button type="button" onclick='document.getElementById("demo17").innerHTML = person17.fullName'>Script17 innerHTML = person17.fullName</button>
2 Réponses
+ 1
Yes, it can.
Check this out...
https://code.sololearn.com/WWYbc6dou0GI/?ref=app
0
thank you, calvin