Pergunta de entrevista da empresa Google

How would you extend Array in JavaScript so that it could add all the values stored in an array?

Respostas da entrevista

Sigiloso

8 de mar. de 2010

This is an exploration of Object prototypes, which demonstrates the level of sophistication with the language.

1

Sigiloso

9 de dez. de 2010

Array.prototype.addValues = function(){ var out=0; for (x = 0; x < arr.length; x++){ out = out + arr[x]; } return out; }

1

Sigiloso

30 de jun. de 2013

arr should be this