Solution:
Yay, using this.setName() worked!
Problem:
1) Didn’t know how to properly title this question
2) I am trying to call a setName() from inside of getName()
Javascript:
window.login
chat = {
setName: function( ) {
},
getName( ) {
//i want to call setName() here, is that possible?
//i tried chat.setName() and setName(), both failed.
}
}
Very simple question, I just am not too knowledgeable in JavaScript. Thank you for the suggestions/help/advice!
Use
this. It refers to the current object: