I have some JavaScript questions I need to nail. To help, I have a simple class that I am writing:
var dataSource = function (src, extension) {
return {
exists: function () {
},
get: function () {
}
}
}();
Questions:
1) In my current understanding of JavaScript, calling dataSource () will create a new object with its own copies of the exists () and get () methods. Am I right?
2) Is there a way to write this so that if I create 1,000,000 dataSource objects, I only need to have one copy of each function?
3) Should I be bothered (2)?
source
share