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>

15th May 2017, 12:57 PM
JJrueda
JJrueda - avatar
2 ответов
+ 1
15th May 2017, 1:21 PM
Calviղ
Calviղ - avatar
0
thank you, calvin
15th May 2017, 2:21 PM
JJrueda
JJrueda - avatar