In most of the code array.length is checked in the for loop. Since this is just a sample code and data set is not much it is ok, but i guess it is suboptimal since the array.length value will be calculated everytime the index value is checked. so instead that we can store it in a variable and use it ?.
In most of the code array.length is checked in the for loop. Since this is just a sample code and data set is not much it is ok, but i guess it is suboptimal since the array.length value will be calculated everytime the index value is checked. so instead that we can store it in a variable and use it ?.