I recently undertook an interview in which I was pointed out that I made some objectionable choices such as initializing a javascript array to null values, it was a project that required a fixed sized multidimensional array, that could only be have two values placed in it depending on user action. The values would be of type string.
So I initiated an array like this:
arr: [null, null, null, null, null],
initialize: function() {
for (var i = 0 ; i < arr.length; i++) {
arr[i] = [null, null, null, null, null];
}
}
Understandably, I could have initiated the array with empty strings instead but this was critically pointed out as a questionable choice. Does anybody know why or what?