Skip to content

Instantly share code, notes, and snippets.

@nguyenhuumy
Last active September 7, 2017 02:41
Show Gist options
  • Save nguyenhuumy/ba2f74da0181dba21de86eb043161864 to your computer and use it in GitHub Desktop.
Save nguyenhuumy/ba2f74da0181dba21de86eb043161864 to your computer and use it in GitHub Desktop.
function solution(A) {
// write your code in JavaScript (Node.js 6.4.0)
function Klass(index, array) {
this._index = index;
this._array = array;
}
Klass.prototype = {
value: function () {
return this._array[this._index];
}
}
T = [];
for (i = 0; i < A.length; i++) {
T.push(new Klass(i, A));
}
return T;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment