Pregunta de entrevista de OneTrust

Asked to optimize a JS code.