Generates a new array with each numeric element squared in environments without native functionality.
Asked in frontend interviews at ByteDance, LinkedIn and Uber