it shows y.length but not x.length? Why is it only y that has .length after it.
I thought that with reduce we compare the x and the y so shouldn’t they both have .length after?
In this example,
x in place of accumulator (acc), (its value = 0 for the first time)
y in place of current value (cur). ( array’s item in relation to its iteration)
Each iteration, x will be result of Math.max(x, y.length). Then, you will again compare new x value with y.length and asign the result of Math.max(x, y.length ) to x again.
In short, you are not comparing the string values inside array to each other. Y is string so you can access lenght property on it, but X is number.