I'm trying to rewrite my code to OOP approach, but stuck in something. There is an example :
var counter = {
column: {
estimation: "tr td:nth-child(3)",
worked: "tr td:nth-child(4)",
ratio: "tr td:nth-child(5)",
difference: "tr td:nth-child(6)"
},
columnLength : function display(){
return $(this.column.estimation).length;
},
Ok, it works! But if I will write almost the same, not in function though:
var counter = {
column: {
estimation: "tr td:nth-child(3)",
worked: "tr td:nth-child(4)",
ratio: "tr td:nth-child(5)",
difference: "tr td:nth-child(6)"
},
columnLength : $(this.column.estimation).length
},
It doesn't, there is error : Column isn't declared.
Why it must be in function? Thx in advance.